Skip to contents

For function(s) in a file

Usage

func_load_path(path, envir = globalenv(), eval = TRUE)

Arguments

path

Path to a file with one or more functions. required

envir

Environment to load default parameters in to. Default: `globalenv()`. required

eval

(logical) evaluate `call`s?. default: `TRUE`. If `TRUE`, any parameter values that have class `call` will be run through `rlang::eval_tidy()`. For example: lists, anonymous functions, function calls themselves. required

Examples

tmpf <- tempfile(fileext=".R")
cat("fun <- function(bar = 5, foo = function() x, ...) bar + 1\n", file=tmpf)
func_load_path(path=tmpf)
bar
#> [1] 5
foo
#> function () 
#> x
#> <environment: 0x560fe92ab360>