drake (version 6.2.1)

plan_summaries: Generate a workflow plan data frame for summarizing multiple analyses of multiple datasets multiple ways.

Description

Uses wildcards to create a new workflow plan data frame from a template data frame.

Usage

plan_summaries(plan, analyses, datasets, gather = rep("list",
  nrow(plan)), sep = "_")

Arguments

plan

workflow plan data frame with commands for the summaries. Use the analysis__ and dataset__ wildcards just like the dataset__ wildcard in plan_analyses().

analyses

workflow plan data frame of analysis instructions

datasets

workflow plan data frame with instructions to make or import the datasets.

gather

Character vector, names of functions to gather the summaries. If not NULL, the length must be the number of rows in the plan. See the gather_plan() function for more.

sep

character scalar, delimiter for creating the new target names

Value

An evaluated workflow plan data frame of instructions for computing summaries of analyses and datasets. analyses of multiple datasets in multiple ways.

See Also

drake_plan(), map_plan(), reduce_by(), gather_by(), reduce_plan(), gather_plan(), evaluate_plan(), expand_plan(), plan_analyses()

Examples

Run this code
# NOT RUN {
# Create the part of the workflow plan data frame for the datasets.
datasets <- drake_plan(
  small = simulate(5),
  large = simulate(50))
# Create a template workflow plan containing the analysis methods.
methods <- drake_plan(
  regression1 = reg1(dataset__),
  regression2 = reg2(dataset__))
# Generate the part of the workflow plan to analyze the datasets.
analyses <- plan_analyses(methods, datasets = datasets)
# Create a template workflow plan dataset with the
# types of summaries you want.
summary_types <- drake_plan(
  summ = summary(analysis__),
  coef = coefficients(analysis__))
# Evaluate the appropriate wildcards to encode the summary targets.
plan_summaries(summary_types, analyses, datasets, gather = NULL)
plan_summaries(summary_types, analyses, datasets)
plan_summaries(summary_types, analyses, datasets, gather = "list")
summs <- plan_summaries(
  summary_types, analyses, datasets, gather = c("list", "rbind"))
# For the final workflow plan, row bind the pieces together.
my_plan <- rbind(datasets, analyses, summs)
my_plan
# }

Run the code above in your browser using DataCamp Workspace