This vignette is a guide to debugging and testing drake
projects. Please also see the “caution” vignette, which addresses drake
's known edge cases, pitfalls, and weaknesses that may or may not be fixed in future releases. For the most up-to-date information on unhandled edge cases, please visit the issue tracker, where you can submit your own bug reports as well. Be sure to search the closed issues too, especially if you are not using the most up-to-date development version.
Most of drake
's functions rely on a central config
list. An understanding of config
will help you grasp the internals. make()
and drake_config()
both return the config
list. Unlike make()
, drake_config()
's return value is visible, and its only purpose is to construct your config
.
load_basic_example() # Get the code with drake_example("basic").
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 15 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
config <- drake_config(my_plan)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 15 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
sort(names(config))
## [1] "args" "cache" "cache_log_file"
## [4] "cache_path" "command" "cpu"
## [7] "elapsed" "envir" "fetch_cache"
## [10] "graph" "hook" "imports_only"
## [13] "jobs" "lazy_load" "log_progress"
## [16] "long_hash_algo" "parallelism" "plan"
## [19] "prepend" "prework" "recipe_command"
## [22] "retries" "seed" "session_info"
## [25] "short_hash_algo" "skip_imports" "skip_safety_checks"
## [28] "targets" "timeout" "trigger"
## [31] "verbose"
The fields of config
mostly arguments to make()
and are documented there. The rest of the fields are as follows.
graph
: An igraph object with the directed acyclic graph (DAG) of the workflow.inventory
: A running list of the cached objects in each storr
namespace. Maintaining this list helps avoid repeated calls to config$cache$list()
, which increases speed.long_hash_algo
: Name of the long hash algorithm used throughout make()
. Used to generate hash keys that will not become the names of files. See the storage vignette for details.seed
: The random number generator seed taken from the user's R session. Each target is built reproducibly using a deterministic function of this seed, and the build does not change the seed outside the scope of the target's command.short_hash_algo
: Name of the short hash algorithm used throughout make()
. Used to generate hash keys that could become names of files. See the storage vignette for details.Early in make()
, the config
list is stored in the cache. You can retrieve it with
read_drake_config()
and you can access parts of it with some companion functions.
read_drake_graph()
read_drake_plan()
The workflow plan data frame is your responsibility, and it takes effort and care. Fortunately, functions in drake
can help. You can check the plan for formatting issues, missing input files, etc. with the check_plan()
function.
load_basic_example() # Get the code with drake_example("basic").
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 16 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
my_plan
## target
## 1 'report.md'
## 2 small
## 3 large
## 4 regression1_small
## 5 regression1_large
## 6 regression2_small
## 7 regression2_large
## 8 summ_regression1_small
## 9 summ_regression1_large
## 10 summ_regression2_small
## 11 summ_regression2_large
## 12 coef_regression1_small
## 13 coef_regression1_large
## 14 coef_regression2_small
## 15 coef_regression2_large
## command
## 1 knit('report.Rmd', quiet = TRUE)
## 2 simulate(48)
## 3 simulate(64)
## 4 reg1(small)
## 5 reg1(large)
## 6 reg2(small)
## 7 reg2(large)
## 8 suppressWarnings(summary(regression1_small$residuals))
## 9 suppressWarnings(summary(regression1_large$residuals))
## 10 suppressWarnings(summary(regression2_small$residuals))
## 11 suppressWarnings(summary(regression2_large$residuals))
## 12 suppressWarnings(summary(regression1_small))$coefficients
## 13 suppressWarnings(summary(regression1_large))$coefficients
## 14 suppressWarnings(summary(regression2_small))$coefficients
## 15 suppressWarnings(summary(regression2_large))$coefficients
check_plan(my_plan) # No issues.
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 16 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
After quality-checking your plan, you should check that you understand how the steps of your workflow are interconnected. The web of dependencies affects which targets are built and which ones are skipped during make()
.
# Hover, click, drag, zoom, and pan. See args 'from' and 'to'.
config <- drake_config(my_plan)
vis_drake_graph(config, width = "100%", height = "500px")
See the rendered graph vignette to learn more about how graphing can help (for example, how to visualize small subgraphs). If you want to take control of your own visNetwork graph, use the dataframes_graph()
function to get data frames of nodes, edges, and legend nodes.
Programmatically, several functions can help you check immediate dependencies.
deps(reg2)
## [1] "lm"
deps(my_plan$command[1]) # File dependencies like report.Rmd are single-quoted.
## [1] "'report.Rmd'" "coef_regression2_small"
## [3] "knit" "large"
## [5] "small"
deps(my_plan$command[nrow(my_plan)])
## [1] "regression2_large" "summary" "suppressWarnings"
List all the reproducibly-tracked objects and files, including imports and targets.
tracked(my_plan, targets = "small")
## connect 16 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
## [1] "small" "simulate" "data.frame" "mtcars" "nrow"
## [6] "sample.int"
tracked(my_plan)
## connect 16 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
## [1] "'report.md'" "small"
## [3] "large" "regression1_small"
## [5] "regression1_large" "regression2_small"
## [7] "regression2_large" "summ_regression1_small"
## [9] "summ_regression1_large" "summ_regression2_small"
## [11] "summ_regression2_large" "coef_regression1_small"
## [13] "coef_regression1_large" "coef_regression2_small"
## [15] "coef_regression2_large" "simulate"
## [17] "reg1" "reg2"
## [19] "'report.Rmd'" "knit"
## [21] "summary" "suppressWarnings"
## [23] "data.frame" "mtcars"
## [25] "nrow" "sample.int"
## [27] "lm"
missed()
reports import dependencies missing from your environment
config <- drake_config(my_plan, verbose = FALSE)
missed(config) # Nothing is missing right now.
## character(0)
outdated()
reports any targets that are outdated, plus any downstream targets that depend on them.
outdated(config)
## [1] "'report.md'" "coef_regression1_large"
## [3] "coef_regression1_small" "coef_regression2_large"
## [5] "coef_regression2_small" "large"
## [7] "regression1_large" "regression1_small"
## [9] "regression2_large" "regression2_small"
## [11] "small" "summ_regression1_large"
## [13] "summ_regression1_small" "summ_regression2_large"
## [15] "summ_regression2_small"
To find out why a target is out of date, you can load the storr-based cache and compare the appropriate hash keys to the output of dependency_profile()
. To use dependency_profile()
, be sure to supply the master configuration list as the config
argument. The same is true for drake_meta()
, another alternative.
load_basic_example() # Get the code with drake_example("basic").
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 16 imports: tmp, error, envir, files, datasets, myplan, f, rules, sim...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
config <- make(my_plan, verbose = FALSE)
# Change a dependency.
reg2 <- function(d) {
d$x3 <- d$x ^ 3
lm(y ~ x3, data = d)
}
outdated(config)
## [1] "'report.md'" "coef_regression2_large"
## [3] "coef_regression2_small" "regression2_large"
## [5] "regression2_small" "summ_regression2_large"
## [7] "summ_regression2_small"
dependency_profile(target = "regression2_small", config = config)
## $cached_command
## [1] "{\n reg2(small) \n}"
##
## $current_command
## [1] "{\n reg2(small) \n}"
##
## $cached_file_modification_time
## NULL
##
## $cached_dependency_hash
## [1] "98cebe6e88a276f8bb3812951bb200092f1f8709cac80c4052bc757ded7a7c2a"
##
## $current_dependency_hash
## [1] "b0418f5af131eef518261355530cd68e5b3bc424f51c4ace4fd126e2474535db"
##
## $hashes_of_dependencies
## reg2 small
## "d47109544c89ca7a" "0224a0a817481a24"
drake_meta(target = "regression2_small", config = config)
## $target
## [1] "regression2_small"
##
## $imported
## [1] FALSE
##
## $missing
## [1] FALSE
##
## $command
## [1] "{\n reg2(small) \n}"
##
## $depends
## [1] "b0418f5af131eef518261355530cd68e5b3bc424f51c4ace4fd126e2474535db"
##
## $file
## [1] NA
config$cache$get_hash(key = "small", namespace = "kernels") # same
## [1] "0224a0a817481a24"
config$cache$get_hash(key = "small") # same
## [1] "0224a0a817481a24"
config$cache$get_hash(key = "reg2", namespace = "kernels") # same
## [1] "d47109544c89ca7a"
config$cache$get_hash(key = "reg2") # different
## [1] "d8e27383fba568d5"
In drake
, the “kernel” of a target or import is the piece of the output that is reproducibly tracked. For ordinary R objects, the kernel is just the object itself. For custom external files, it is a separate hash. But for functions, the kernel is the deparsed body of the function, together with the dependency hash if the function is imported (see drake:::store_function()
).
The internal functions drake:::meta()
and drake:::meta_list()
compute the metadata on each target that drake
uses to decide which targets to build and which to skip (via drake:::should_build_target()
). Then, after the target/import is processed, drake:::finish_meta()
updates the metadata (except for the $missing
element) before it is cached. See read_drake_meta()
.
read_drake_meta("'report.md'")
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## $target
## [1] "'report.md'"
##
## $imported
## [1] FALSE
##
## $missing
## [1] TRUE
##
## $command
## [1] "{\n knit(\"report.Rmd\", quiet = TRUE) \n}"
##
## $depends
## [1] "878ada0bac9bf652b635ebec98c33566bc347908bba59e77ae9285621579a1cd"
##
## $file
## [1] "ffc4dab3273ab3bed483915f91851350ac4ce2b754bd6ad097981407ac1b449e"
##
## $mtime
## [1] "2018-01-26 00:56:46 EST"
##
## $build_times
## item type elapsed user system
## 1 'report.md' target 0.04 0.036 0.004
To track dependencies and make decisions about what needs building, make()
store the fingerprint, or hash, of each target. Hashing is great for detecting the right changes in targets, but if all you want to do is test and debug a workflow, the full rigor can be time-consuming.
Fortunately, you can change the triggers that tell drake
when to (re)build each target. Below, drake
disregards outdatedness and just builds the targets that are missing.
clean(verbose = FALSE) # Start from scratch
config <- make(my_plan, trigger = "missing")
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## Unloading targets from environment:
## small
## large
## coef_regression2_small
## connect 16 imports: f, tmp, reg1, reg2, error, my_plan, myplan, good_plan, si...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
## check 9 items: 'report.Rmd', data.frame, knit, lm, mtcars, nrow, sample.int, ...
## check 3 items: reg1, reg2, simulate
## check 2 items: large, small
## target large: trigger "missing"
## target small: trigger "missing"
## check 4 items: regression1_large, regression1_small, regression2_large, regre...
## target regression1_large: trigger "missing"
## target regression1_small: trigger "missing"
## target regression2_large: trigger "missing"
## target regression2_small: trigger "missing"
## check 8 items: coef_regression1_large, coef_regression1_small, coef_regressio...
## target coef_regression1_large: trigger "missing"
## target coef_regression1_small: trigger "missing"
## target coef_regression2_large: trigger "missing"
## target coef_regression2_small: trigger "missing"
## target summ_regression1_large: trigger "missing"
## target summ_regression1_small: trigger "missing"
## target summ_regression2_large: trigger "missing"
## target summ_regression2_small: trigger "missing"
## check 1 item: 'report.md'
## unload 11 items: regression1_small, regression1_large, regression2_small, reg...
## target 'report.md': trigger "missing"
## Used non-default triggers. Some targets may be not be up to date.
You can choose from any of the following triggers for all targets or for each target individually.
always
: Always build the target regardless of the circumstance, even if the target is already up to date. any
: Apply all the triggers below (default). In other words, trigger a build if the command
trigger, depends
trigger, file
trigger, or missing
trigger is activated.command
: Build if the workflow plan command changed since the last make()
or the target is missing.depends
: Build if any of the target's dependencies changed since the last make()
or if the target is missing.file
: Build if the target is an output file and the file is either missing or corrupted. Also build if the file's hash is missing from the cache.missing
: Build if and only if the target is missing.To select triggers for individual targets, create an optional trigger
column in the workflow plan data frame. Entries in this column override the trigger
argument to make()
my_plan$trigger <- "command"
my_plan$trigger[1] <- "file"
my_plan
## target
## 1 'report.md'
## 2 small
## 3 large
## 4 regression1_small
## 5 regression1_large
## 6 regression2_small
## 7 regression2_large
## 8 summ_regression1_small
## 9 summ_regression1_large
## 10 summ_regression2_small
## 11 summ_regression2_large
## 12 coef_regression1_small
## 13 coef_regression1_large
## 14 coef_regression2_small
## 15 coef_regression2_large
## command trigger
## 1 knit('report.Rmd', quiet = TRUE) file
## 2 simulate(48) command
## 3 simulate(64) command
## 4 reg1(small) command
## 5 reg1(large) command
## 6 reg2(small) command
## 7 reg2(large) command
## 8 suppressWarnings(summary(regression1_small$residuals)) command
## 9 suppressWarnings(summary(regression1_large$residuals)) command
## 10 suppressWarnings(summary(regression2_small$residuals)) command
## 11 suppressWarnings(summary(regression2_large$residuals)) command
## 12 suppressWarnings(summary(regression1_small))$coefficients command
## 13 suppressWarnings(summary(regression1_large))$coefficients command
## 14 suppressWarnings(summary(regression2_small))$coefficients command
## 15 suppressWarnings(summary(regression2_large))$coefficients command
# Change an imported dependency:
reg2
## function(d) {
## d$x3 <- d$x ^ 3
## lm(y ~ x3, data = d)
## }
## <bytecode: 0x34d35c8>
reg2 <- function(d) {
d$x3 <- d$x ^ 3
lm(y ~ x3, data = d)
}
make(my_plan, trigger = "any") # Nothing changes!
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## Unloading targets from environment:
## small
## large
## coef_regression2_small
## connect 16 imports: files, command, simulate, good_plan, config, reg1, envir,...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
## check 9 items: 'report.Rmd', data.frame, knit, lm, mtcars, nrow, sample.int, ...
## check 3 items: reg1, reg2, simulate
## check 2 items: large, small
## check 4 items: regression1_large, regression1_small, regression2_large, regre...
## check 8 items: coef_regression1_large, coef_regression1_small, coef_regressio...
## check 1 item: 'report.md'
## Used non-default triggers. Some targets may be not be up to date.
The outdated()
function responds to triggers. For example, even if outdated(my_plan)
shows all targets up to date, outdated(my_plan, trigger = "always")
will claim that all the targets are outdated.
Similar to triggers, you can also to skip the processing of imported objects and files. However, you should only use this for testing purposes. If some of your imports are not already cached and up to date, any built targets will be out of sync. In other words, outdated()
is more likely to be wrong, and your project may no longer be reproducible.
clean(verbose = FALSE)
my_plan$trigger <- NULL
make(my_plan, skip_imports = TRUE)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 16 imports: files, command, simulate, good_plan, config, reg1, envir,...
## connect 15 targets: 'report.md', small, large, regression1_small, regression1...
## check 2 items: large, small
## target large
## target small
## check 4 items: regression1_large, regression1_small, regression2_large, regre...
## target regression1_large
## target regression1_small
## target regression2_large
## target regression2_small
## check 8 items: coef_regression1_large, coef_regression1_small, coef_regressio...
## target coef_regression1_large
## target coef_regression1_small
## target coef_regression2_large
## target coef_regression2_small
## target summ_regression1_large
## target summ_regression1_small
## target summ_regression2_large
## target summ_regression2_small
## check 1 item: 'report.md'
## unload 11 items: regression1_small, regression1_large, regression2_small, reg...
## target 'report.md'
## Skipped the imports. If some imports are not already cached, targets could be out of date.
See the timeout
, cpu
, elapsed
, and retries
argument to make()
.
clean(verbose = FALSE)
f <- function(...){
Sys.sleep(1)
}
debug_plan <- drake_plan(x = 1, y = f(x))
debug_plan
## target command
## 1 x 1
## 2 y f(x)
withr::with_message_sink(
stdout(),
make(debug_plan, timeout = 1e-3, retries = 2)
)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 20 imports: files, small, command, large, simulate, debug_plan, good_...
## connect 2 targets: x, y
## check 1 item: Sys.sleep
## check 1 item: f
## check 1 item: x
## target x
## check 1 item: y
## target y
## Error building target y: reached elapsed time limit
## retry y: 1 of 2
## Error building target y: reached elapsed time limit
## retry y: 2 of 2
## Error building target y: reached elapsed time limit
## fail y
## Error: Target 'y' failed to build. Use diagnose(y) to retrieve diagnostic information.
To tailor these settings to each individual target, create new timeout
, cpu
, elapsed
, or retries
columns in your workflow plan. These columns override the analogous arguments to make()
.
clean(verbose = FALSE)
debug_plan$timeout <- c(1e-3, 2e-3)
debug_plan$retries <- 1:2
debug_plan
## target command timeout retries
## 1 x 1 0.001 1
## 2 y f(x) 0.002 2
withr::with_message_sink(
new = stdout(),
make(debug_plan, timeout = Inf, retries = 0)
)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## Unloading targets from environment:
## x
## connect 20 imports: files, small, command, large, simulate, debug_plan, good_...
## connect 2 targets: x, y
## check 1 item: Sys.sleep
## check 1 item: f
## check 1 item: x
## target x
## check 1 item: y
## target y
## Error building target y: reached elapsed time limit
## Error building target y: reached elapsed time limit
## Error building target y: reached elapsed time limit
## fail y
## Error: Target 'y' failed to build. Use diagnose(y) to retrieve diagnostic information.
Drake
records
make()
, anddiagnose(verbose = FALSE)
## [1] "y"
f <- function(x){
if (x < 0){
stop("unusual error")
}
}
bad_plan <- drake_plan(
a = 12,
b = -a,
my_target = f(b)
)
bad_plan
## target command
## 1 a 12
## 2 b -a
## 3 my_target f(b)
withr::with_message_sink(
new = stdout(),
make(bad_plan)
)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## connect 21 imports: x, files, small, command, large, simulate, debug_plan, go...
## connect 3 targets: a, b, my_target
## check 1 item: stop
## check 1 item: f
## check 1 item: a
## target a
## check 1 item: b
## target b
## check 1 item: my_target
## unload 1 item: a
## target my_target
## Error building target my_target: unusual error
## fail my_target
## Error: Target 'my_target' failed to build. Use diagnose(my_target) to retrieve diagnostic information.
failed(verbose = FALSE) # from the last make() only
## [1] "my_target" "y"
diagnose(verbose = FALSE) # from all previous make()'s
## [1] "my_target" "y"
error <- diagnose(my_target, verbose = FALSE)
str(error)
## List of 3
## $ message: chr "unusual error"
## $ call : language f(b)
## $ calls :List of 3
## ..$ : language (function() { { ...
## ..$ : language f(b)
## ..$ : language stop("unusual error")
## .. ..- attr(*, "srcref")=Class 'srcref' atomic [1:8] 5 5 5 25 5 25 5 5
## .. .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x36d2d58>
## - attr(*, "class")= chr [1:3] "simpleError" "error" "condition"
error$calls # View the traceback.
## [[1]]
## (function() {
## {
## f(b)
## }
## })()
##
## [[2]]
## f(b)
##
## [[3]]
## stop("unusual error")
To figure out what went wrong, you could try to build the failed target interactively. To do that, you must load the target's dependencies in your workspace, which you can easily do with loadd(my_target, deps = TRUE)
. Then, build it on its own with drake_build()
.
# Pretend we just opened a new R session.
library(drake)
# Unloads target `b`.
config <- drake_config(plan = bad_plan)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## Unloading targets from environment:
## b
## connect 21 imports: x, files, small, command, large, simulate, debug_plan, go...
## connect 3 targets: a, b, my_target
# my_target depends on b.
"b" %in% ls()
## [1] FALSE
loadd(my_target, deps = TRUE)
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
"b" %in% ls()
## [1] TRUE
# Try to build my_target until the error is fixed.
# Skip all that pesky work checking dependencies.
drake_build(target = "my_target", config = config)
## target my_target
## fail my_target
## Error: Target 'my_target' failed to build. Use diagnose(my_target) to retrieve diagnostic information.
diagnose(my_target)$message
## cache /tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake
## [1] "unusual error"
f
## function(x){
## if (x < 0){
## stop("unusual error")
## }
## }
# Aha! The error was in f(). Let's fix it and try again.
f <- function(x){
return(x)
}
drake_build(target = "my_target", config = config)
## target my_target
After your project is at least somewhat built, you can inspect and read your results from the cache.
make(my_plan, verbose = FALSE)
# drake_session(verbose = FALSE) # Prints the sessionInfo() of the last make(). # nolint
cached(verbose = FALSE)
## [1] "'report.Rmd'" "'report.md'"
## [3] "Sys.sleep" "a"
## [5] "b" "coef_regression1_large"
## [7] "coef_regression1_small" "coef_regression2_large"
## [9] "coef_regression2_small" "data.frame"
## [11] "f" "knit"
## [13] "large" "lm"
## [15] "mtcars" "my_target"
## [17] "nrow" "reg1"
## [19] "reg2" "regression1_large"
## [21] "regression1_small" "regression2_large"
## [23] "regression2_small" "sample.int"
## [25] "simulate" "small"
## [27] "stop" "summ_regression1_large"
## [29] "summ_regression1_small" "summ_regression2_large"
## [31] "summ_regression2_small" "summary"
## [33] "suppressWarnings" "x"
built(verbose = FALSE)
## [1] "'report.md'" "coef_regression1_large"
## [3] "coef_regression1_small" "coef_regression2_large"
## [5] "coef_regression2_small" "large"
## [7] "regression1_large" "regression1_small"
## [9] "regression2_large" "regression2_small"
## [11] "small" "summ_regression1_large"
## [13] "summ_regression1_small" "summ_regression2_large"
## [15] "summ_regression2_small"
imported(verbose = FALSE)
## [1] "'report.Rmd'" "Sys.sleep" "a"
## [4] "b" "data.frame" "f"
## [7] "knit" "lm" "mtcars"
## [10] "my_target" "nrow" "reg1"
## [13] "reg2" "sample.int" "simulate"
## [16] "stop" "summary" "suppressWarnings"
## [19] "x"
loadd(large, verbose = FALSE)
head(large)
## x y
## 1 3.570 15.0
## 2 3.570 15.0
## 3 3.435 15.2
## 4 2.780 21.4
## 5 2.620 21.0
## 6 3.150 22.8
readd(small, verbose = FALSE)
## x y
## 1 3.440 17.8
## 2 3.570 14.3
## 3 1.935 27.3
## 4 1.835 33.9
## 5 5.424 10.4
## 6 2.770 19.7
## 7 3.170 15.8
## 8 2.780 21.4
## 9 1.935 27.3
## 10 2.620 21.0
## 11 3.190 24.4
## 12 2.875 21.0
## 13 1.513 30.4
## 14 3.840 13.3
## 15 2.140 26.0
## 16 2.770 19.7
## 17 1.835 33.9
## 18 2.620 21.0
## 19 3.460 18.1
## 20 2.620 21.0
## 21 3.440 17.8
## 22 4.070 16.4
## 23 3.215 21.4
## 24 3.840 13.3
## 25 2.140 26.0
## 26 5.250 10.4
## 27 3.190 24.4
## 28 5.345 14.7
## 29 2.620 21.0
## 30 2.200 32.4
## 31 3.460 18.1
## 32 3.170 15.8
## 33 5.345 14.7
## 34 1.935 27.3
## 35 2.875 21.0
## 36 3.190 24.4
## 37 2.465 21.5
## 38 2.780 21.4
## 39 3.780 15.2
## 40 3.190 24.4
## 41 1.615 30.4
## 42 3.150 22.8
## 43 5.250 10.4
## 44 3.460 18.1
## 45 2.780 21.4
## 46 3.840 13.3
## 47 3.170 15.8
## 48 3.460 18.1
progress(verbose = FALSE)
## 'report.Rmd' 'report.md' coef_regression1_large
## "finished" "finished" "finished"
## coef_regression1_small coef_regression2_large coef_regression2_small
## "finished" "finished" "finished"
## data.frame knit large
## "finished" "finished" "finished"
## lm mtcars nrow
## "finished" "finished" "finished"
## reg1 reg2 regression1_large
## "finished" "finished" "finished"
## regression1_small regression2_large regression2_small
## "finished" "finished" "finished"
## sample.int simulate small
## "finished" "finished" "finished"
## summ_regression1_large summ_regression1_small summ_regression2_large
## "finished" "finished" "finished"
## summ_regression2_small summary suppressWarnings
## "finished" "finished" "finished"
## y
## "failed"
in_progress(verbose = FALSE) # Unfinished targets
## character(0)
There are functions to help you locate the project's cache.
find_project()
## [1] "/tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes"
find_cache()
## [1] "/tmp/Rtmp7EbM7A/Rbuild75ca54d145b9/drake/vignettes/.drake"
For more information on the cache, see the storage vignette.
The load_basic_example()
function loads the basic example from drake_example("basic")
right into your workspace. The workflow plan data frame, workspace, and import files are set up for you. Only make(my_plan)
is left to you.
Drake
has many more built-in examples. To see your choices, use
drake_examples()
## [1] "Docker-psock" "Makefile-cluster" "basic"
## [4] "gsp" "packages" "sge"
## [7] "slurm" "torque"
To write the files for an example, use drake_example()
.
drake_example("basic")
drake_example("slurm")