| tar_assign | R Documentation |
An assignment-based domain-specific language for pipeline construction.
tar_assign(targets)
targets |
An expression with special syntax to define a
collection of targets in a pipeline.
Example:
|
A list of target definition objects. See the "Target definition objects" section for background.
Most tarchetypes functions are target factories,
which means they return target definition objects
or lists of target definition objects.
target definition objects represent
skippable steps of the analysis pipeline
as described at https://books.ropensci.org/targets/.
Please read the walkthrough at
https://books.ropensci.org/targets/walkthrough.html
to understand the role of target definition
objects in analysis pipelines.
For developers, https://wlandau.github.io/targetopia/contributing.html#target-factories explains target factories (functions like this one which generate targets) and the design specification at https://books.ropensci.org/targets-design/ details the structure and composition of target definition objects.
Other Domain-specific languages for pipeline construction:
tar_tangle()
if (identical(Sys.getenv("TAR_LONG_EXAMPLES"), "true")) {
targets::tar_dir({ # tar_dir() runs code from a temporary directory.
write.csv(airquality, "data.csv", row.names = FALSE)
targets::tar_script({
library(tarchetypes)
tar_option_set(packages = c("readr", "dplyr", "ggplot2"))
tar_assign({
file <- tar_target("data.csv", format = "file")
data <- read_csv(file, col_types = cols()) |>
filter(!is.na(Ozone)) |>
tar_target()
model = lm(Ozone ~ Temp, data) |>
coefficients() |>
tar_target()
plot <- {
ggplot(data) +
geom_point(aes(x = Temp, y = Ozone)) +
geom_abline(intercept = model[1], slope = model[2]) +
theme_gray(24)
} |>
tar_target()
})
})
targets::tar_make()
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.