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

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

Arguments

plan

workflow plan data frame with commands for the summaries. Use the analysis__ and dataset__ wildcards just like the dataset__ wildcard in 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() function for more.

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

plan_analyses(), make(), drake_plan()

Examples

# 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)
#> # A tibble: 8 x 2 #> target command #> <chr> <chr> #> 1 summ_regression1_small summary(regression1_small) #> 2 summ_regression1_large summary(regression1_large) #> 3 summ_regression2_small summary(regression2_small) #> 4 summ_regression2_large summary(regression2_large) #> 5 coef_regression1_small coefficients(regression1_small) #> 6 coef_regression1_large coefficients(regression1_large) #> 7 coef_regression2_small coefficients(regression2_small) #> 8 coef_regression2_large coefficients(regression2_large)
plan_summaries(summary_types, analyses, datasets)
#> # A tibble: 10 x 2 #> target command #> <chr> <chr> #> 1 coef list(coef_regression1_small = coef_regression1_small… #> 2 summ list(summ_regression1_small = summ_regression1_small… #> 3 summ_regression1_small summary(regression1_small) #> 4 summ_regression1_large summary(regression1_large) #> 5 summ_regression2_small summary(regression2_small) #> 6 summ_regression2_large summary(regression2_large) #> 7 coef_regression1_small coefficients(regression1_small) #> 8 coef_regression1_large coefficients(regression1_large) #> 9 coef_regression2_small coefficients(regression2_small) #> 10 coef_regression2_large coefficients(regression2_large)
plan_summaries(summary_types, analyses, datasets, gather = "list")
#> # A tibble: 10 x 2 #> target command #> <chr> <chr> #> 1 coef list(coef_regression1_small = coef_regression1_small… #> 2 summ list(summ_regression1_small = summ_regression1_small… #> 3 summ_regression1_small summary(regression1_small) #> 4 summ_regression1_large summary(regression1_large) #> 5 summ_regression2_small summary(regression2_small) #> 6 summ_regression2_large summary(regression2_large) #> 7 coef_regression1_small coefficients(regression1_small) #> 8 coef_regression1_large coefficients(regression1_large) #> 9 coef_regression2_small coefficients(regression2_small) #> 10 coef_regression2_large coefficients(regression2_large)
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
#> # A tibble: 16 x 2 #> target command #> <chr> <chr> #> 1 small simulate(5) #> 2 large simulate(50) #> 3 regression1_small reg1(small) #> 4 regression1_large reg1(large) #> 5 regression2_small reg2(small) #> 6 regression2_large reg2(large) #> 7 coef rbind(coef_regression1_small = coef_regression1_smal… #> 8 summ list(summ_regression1_small = summ_regression1_small… #> 9 summ_regression1_small summary(regression1_small) #> 10 summ_regression1_large summary(regression1_large) #> 11 summ_regression2_small summary(regression2_small) #> 12 summ_regression2_large summary(regression2_large) #> 13 coef_regression1_small coefficients(regression1_small) #> 14 coef_regression1_large coefficients(regression1_large) #> 15 coef_regression2_small coefficients(regression2_small) #> 16 coef_regression2_large coefficients(regression2_large)