future_map_maker: Make your own versions of the 'furrr' 'future_map' functions

View source: R/future_walk.R

future_map_makerR Documentation

Make your own versions of the furrr future_map functions

Description

This function is responsible for making the future_walk and future_cnd_map sets of functions. The code used to make it is pretty helpful for understanding R's meta-programming, and if you need to modify the input function .f to the future_map functions, you can change the decorator_func argument to whatever you want.

Usage

future_map_maker(.orig_function, ...,
  decorator_func = cs::collect_decorator)

Arguments

.orig_function

the specific future_map-like function you want to base yours off of

...

additional arguments to pass into decorator_func

decorator_func

the function that you want to use to modify the given .f argument I use the term "decorator" like this is analogous to Python, but it's not 100% accurate

Details

I wanted functions that would behave with all the complexity of furrr's future_map functions (which, due to this complexity, are mostly a blackbox to me), while modifying the behavior of the specified input function, basically so I wouldn't have to keep on adding zplyr::collect_all to these argument functions, like: furrr::future_map(c(1:4), ~zplyr::collect_all(saveRDS(...))). I'm inordinately proud of what I did here, making a function that would be able to take any of the future_map functions and turn them into what I had in mind. Ooooh lawdy, I loved learning this.

See Also

collect_decorator, warn_about_package


burchill/cs documentation built on May 28, 2023, 1:29 p.m.