Automatically map complex operations safely or quietly, and quickly see the captured side effects.

The collateral package extends the power of purrr::safely() and purrr::quietly(), providing variants of map()map_safely() and map_quietly()—that automatically apply the appropriate function wrapper and print the resulting output nicely.

This is especially useful for tidy workflows: you can nest() a data frame, apply a complex operation (such as building a regression model or building and saving a plot) to each group and quickly see which groups need to be inspected in more detail:

Installation

We’ll submit to CRAN soon, but for now, use devtools to install collateral:

devtools::install_github('rensa/collateral')

Example

Example of styled collateral output

collateral uses pillar to style output, so supported terminals will also color the output! Properly styling knitted output is still on the to-do list, though.

If you’re a fan of iterating over two or more inputs in lockstep, then map2() and pmap() variants are also provided:

collateral also provides tally_*() and has_() functions to help you filter or summarise your side effects, as well as a summary() mehod. If you haven’t used a list-column workflow before, take a look at the vignette to see how it’s done!

Support

If you have a problem with collateral, please don’t hesitate to file an issue or get in touch with me!