Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

collateral (version 0.5.2)

summary: Summarise mapped side effects.

Description

The summary() method for a safely_mapped or quietly_mapped list (or list-column) prints out the total number of elements (rows), as well as the number that each returned results and errors (for safely_mapped) or returned results, output, messages and warnings (for quietly_mapped). It also invisibly returns a named vector with these counts.

Usage

# S3 method for safely_mapped
summary(object, ...)

# S3 method for quietly_mapped summary(object, ...)

# S3 method for peacefully_mapped summary(object, ...)

Arguments

object

A safely_mapped or quietly_mapped list to summarise.

...

Other arguments passed to summary().

Value

A named vector containing counts of the components named in map_safely().

Details

Although the output can be used in tidy workflows (for automated testing, for example), tally functions like tally_results() tend to be more convenient for this purpose.

Importantly, the summary() method tells you how many elements were returned a type of side effect, not the number of those side effects. Some list elements might return more than one warning, for example, and these are not counted separately.

Examples

Run this code
# NOT RUN {
library(tibble)
library(dplyr)
library(tidyr)
library(collateral)

list("a", 10, 100) %>% map_safely(log) %>% summary()
list(5, -12, 103) %>% map_quietly(log) %>% summary()

# }

Run the code above in your browser using DataLab