Learn R Programming

drake (version 4.4.0)

deps: Function deps

Description

List the dependencies of a function or workflow plan command. Or, if the argument is a single-quoted string that points to a dynamic knitr report, the dependencies of the expected compiled output will be given. For example, deps("'report.Rmd'") will return target names found in calls to loadd() and readd() in active code chunks. These targets are needed in order to run knit('report.Rmd') to produce the output file 'report.md', so technically, they are dependencies of 'report.md', not 'report.Rmd'

Usage

deps(x)

Arguments

x

Either a function or a string. Strings are commands from your workflow plan data frame.

Value

names of dependencies. Files wrapped in single quotes. The other names listed are functions or generic objects.

Examples

Run this code
# NOT RUN {
f <- function(x, y){
  out <- x + y + g(x)
  saveRDS(out, 'out.rds')
}
deps(f)
my_plan <- workplan(
  x = 1 + some_object,
  my_target = x + readRDS('tracked_input_file.rds'),
  return_value = f(x, y, g(z + w))
)
deps(my_plan$command[1])
deps(my_plan$command[2])
deps(my_plan$command[3])
# }
# NOT RUN {
load_basic_example() # Writes 'report.Rmd'.
deps("'report.Rmd'") # dependencies of future knitted output 'report.md'
# }

Run the code above in your browser using DataLab