drake (version 6.2.1)

file_in: Declare the file inputs of a workflow plan command.

Description

Use this function to help write the commands in your workflow plan data frame. See the examples for a full explanation.

Usage

file_in(...)

Arguments

...

Character strings. File paths of input files to a command in your workflow plan data frame.

Value

A character vector of declared input file paths.

See Also

file_out(), knitr_in(), ignore()

Examples

Run this code
# NOT RUN {
test_with_dir("Contain side effects", {
# The `file_out()` and `file_in()` functions
# just takes in strings and returns them.
file_out("summaries.txt")
# Their main purpose is to orchestrate your custom files
# in your workflow plan data frame.
suppressWarnings(
  plan <- drake_plan(
    write.csv(mtcars, file_out("mtcars.csv")),
    contents = read.csv(file_in("mtcars.csv")),
    strings_in_dots = "literals" # deprecated but useful: no single quotes needed. # nolint
  )
)
plan
# drake knows "\"mtcars.csv\"" is the first target
# and a dependency of `contents`. See for yourself:
make(plan)
file.exists("mtcars.csv")
# See also `knitr_in()`. `knitr_in()` is like `file_in()`
# except that it analyzes active code chunks in your `knitr`
# source file and detects non-file dependencies.
# That way, updates to the right dependencies trigger rebuilds
# in your report.
})
# }

Run the code above in your browser using DataLab