tally_results(x) tally_errors(x) tally_warnings(x) tally_messages(x) tally_output(x)
An integer vector of length 1.
Importantly, the tally functions tell you how many elements returned a type of side effect, not how many side effects were returned. Some list elements might return more than one warning, for example, and these are not counted separately.
library(tibble) library(dplyr) library(tidyr) library(collateral) list("a", 10, 100) %>% map_safely(log) %>% tally_errors()#>  1#>  1# if you're working with list-columns, the tally functions are useful # in conjunction with dplyr::summarise() mtcars %>% rownames_to_column(var = "car") %>% as_tibble() %>% select(car, cyl, disp, wt) %>% # spike some rows in cyl == 4 to make them fail mutate(wt = dplyr::case_when( wt < 2 ~ -wt, TRUE ~ wt)) %>% # nest and do some operations quietly() nest(data = -cyl) %>% mutate(qlog = map_quietly(data, ~ log(.$wt))) %>% summarise( num_results = tally_results(qlog), num_warnings = tally_warnings(qlog))#> # A tibble: 1 x 2 #> num_results num_warnings #> <int> <int> #> 1 3 1