path <- system.file("examples", "ady.mustache", package = "mighty.component")
x <- get_component(path)$render(
domain = "adae",
variable = "ASTDY",
date = "ASTDT"
)
x$code
# Write the code to an R script
script <- tempfile(fileext = ".R")
x$stream(script)
readLines(script)
unlink(script)
if (FALSE) { # rlang::is_installed(c("admiral", "dplyr"))
# Evaluate the code in a new environment
env <- new.env()
env$adae <- data.frame(
TRTSDT = as.Date("2024-01-01"),
ASTDT = as.Date(c("2024-01-01", "2024-01-10"))
)
x$eval(envir = env)
env$adae
}
Run the code above in your browser using DataLab