# load the example configuration
file <- system.file("config.R", package = "ronfig")
cat(readChar(file, file.info(file)$size))
# default configuration
str(load_config(file))
# debug configuration
str(load_config(file, "debug"))
# forecast configuration
str(load_config(file, "forecast"))
# Injecting crated function
f <- tempfile()
cat("default <- list(a=mean(1:10))", file = f)
# will fail as mean() not available
tryCatch(with(load_config(f), a), error = conditionMessage)
# will work if we inject crated mean
crate <- carrier::crate(function(x) mean(x))
with(load_config(f, crates = list(mean = crate)), a)
unlink(f)
Run the code above in your browser using DataLab