drake (version 6.2.1)

file_store: Tell drake that you want information on a file (target or import), not an ordinary object.

Description

This function simply wraps literal double quotes around the argument x so drake knows it is the name of a file. Use when you are calling functions like deps_code(): for example, deps_code(file_store("report.md")). See the examples for details. Internally, drake wraps the names of file targets/imports inside literal double quotes to avoid confusion between files and generic R objects.

Usage

file_store(x)

Arguments

x

character string to be turned into a filename understandable by drake (i.e., a string with literal single quotes on both ends).

Value

A single-quoted character string: i.e., a filename understandable by drake.

Examples

Run this code
# NOT RUN {
  # Wraps the string in single quotes.
  file_store("my_file.rds") # "'my_file.rds'"
  
# }
# NOT RUN {
  test_with_dir("contain side effects", {
  load_mtcars_example() # Get the code with drake_example("mtcars").
  make(my_plan) # Run the workflow to build the targets
  list.files() # Should include input "report.Rmd" and output "report.md".
  head(readd(small)) # You can use symbols for ordinary objects.
  # But if you want to read cached info on files, use `file_store()`.
  readd(file_store("report.md"), character_only = TRUE) # File fingerprint.
  deps_code(file_store("report.Rmd"))
  config <- drake_config(my_plan)
  dependency_profile(
    file_store("report.Rmd"),
    config = config,
    character_only = TRUE
  )
  loadd(list = file_store("report.md"))
  get(file_store("report.md"))
  })
  
# }

Run the code above in your browser using DataLab