drake
plan
R/drake_plan_helpers.R
drake_plan_source.Rd
You supply a plan, and drake_plan_source()
supplies code to generate that plan. If you have the
prettycode
package,
installed, you also get nice syntax highlighting in the console
when you print it.
drake_plan_source(plan)
plan | A workflow plan data frame (see |
---|
a character vector of lines of text. This text
is a call to drake_plan()
that produces the plan you provide.
plan <- drake::drake_plan( small_data = download_data("https://some_website.com"), large_data_raw = target( command = download_data("https://lots_of_data.com"), trigger = trigger( change = time_last_modified("https://lots_of_data.com"), command = FALSE, depend = FALSE ), timeout = 1e3 ) ) print(plan)#> # A tibble: 2 x 4 #> target command trigger timeout #> <chr> <expr_lst> <expr_lst> <dbl> #> 1 small_data download_data("https… NA … NA #> 2 large_dat… download_data("https… trigger(change = time_last_modified(… 1000if (requireNamespace("styler", quietly = TRUE)) { source <- drake_plan_source(plan) print(source) # Install the prettycode package for syntax highlighting. file <- tempfile() # Path to an R script to contain the drake_plan() call. writeLines(source, file) # Save the code to an R script. }#> drake_plan( #> small_data = download_data("https://some_website.com"), #> large_data_raw = target( #> command = download_data("https://lots_of_data.com"), #> trigger = trigger( #> change = time_last_modified("https://lots_of_data.com"), #> command = FALSE, #> depend = FALSE #> ), #> timeout = 1000 #> ) #> )