make_with_recipe {makepipe} | R Documentation |
Make targets out of dependencies using a recipe
Description
Make targets out of dependencies using a recipe
Usage
make_with_recipe(
recipe,
targets,
dependencies = NULL,
packages = NULL,
envir = new.env(parent = parent.frame()),
quiet = getOption("makepipe.quiet"),
force = FALSE,
label = NULL,
note = NULL,
...
)
Arguments
recipe |
A chunk of R code which makes the |
targets |
A character vector of paths to files |
dependencies |
A character vector of paths to files which the |
packages |
A character vector of names of packages which |
envir |
The environment in which to execute the |
quiet |
A logical determining whether or not messages are signaled |
force |
A logical determining whether or not execution of the |
label |
A short label for the |
note |
A description of what the |
... |
Additional parameters to pass to |
Value
A Segment
object containing execution metadata.
See Also
Other make:
make_with_dir()
,
make_with_source()
Examples
## Not run:
# Merge files in fresh environment if raw data has been updated since last
# merged
make_with_recipe(
recipe = {
dat <- readRDS("data/raw_data.Rds")
pop <- readRDS("data/pop_data.Rds")
merged_dat <- merge(dat, pop, by = "id")
saveRDS(merged_dat, "data/merged_data.Rds")
},
targets = "data/merged_data.Rds",
dependencies = c("data/raw_data.Rds", "data/raw_pop.Rds")
)
# Merge files in current environment if raw data has been updated since last
# merged. (If recipe executed, all objects bound in source will be available
# in current env).
make_with_recipe(
recipe = {
dat <- readRDS("data/raw_data.Rds")
pop <- readRDS("data/pop_data.Rds")
merged_dat <- merge(dat, pop, by = "id")
saveRDS(merged_dat, "data/merged_data.Rds")
},
targets = "data/merged_data.Rds",
dependencies = c("data/raw_data.Rds", "data/raw_pop.Rds"),
envir = environment()
)
# Merge files in global environment if raw data has been updated since last
# merged. (If source executed, all objects bound in source will be available
# in global env).
make_with_recipe(
recipe = {
dat <- readRDS("data/raw_data.Rds")
pop <- readRDS("data/pop_data.Rds")
merged_dat <- merge(dat, pop, by = "id")
saveRDS(merged_dat, "data/merged_data.Rds")
},
targets = "data/merged_data.Rds",
dependencies = c("data/raw_data.Rds", "data/raw_pop.Rds"),
envir = globalenv()
)
## End(Not run)