make_available: Assign objects to environments

View source: R/call-flexibly.R

make_availableR Documentation

Assign objects to environments

Description

Programming aid: See details for more information on how to use it.

Usage

make_available(..., verbose = TRUE)

Arguments

...

Named lists provided as named arguments.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

Details

Works in combinaiton with call_flexibly. Provided named lists of ... are joined to one overall list whoose slots are the argument lists for all flexibly called functions and whoose names correspond to the function names. It calls base::assign() within purrr::imap() to assign every argument list to the environment of the calling function in order that all flexible calls find their argument lists.

Examples

# Not run:

  example_fun <- function(...){

      make_available(...)

      ggplot(data = mtcars, mapping = aes(x = wt, y = hp)) +
       call_flexibly(fn = "geom_point", fn.ns = "ggplot2") +
       call_flexibly(fn = "theme", fn.ns = "ggplot2")

  }


  gp_list <- list(color = "red", size = 4, shape = 15)
  theme_list <- list(panel.background = element_rect(fill = "red", colour = "black"))

   example_fun(geom_point = gp_list, theme = theme_list)


kueckelj/confuns documentation built on July 4, 2024, 4:53 p.m.