drake_tempfile: drake tempfile *[Stable]*

View source: R/decorate_storr.R

drake_tempfileR Documentation

drake tempfile [Stable]

Description

Create the path to a temporary file inside drake's cache.

Usage

drake_tempfile(path = NULL, cache = drake::drake_cache(path = path))

Arguments

path

Path to a drake cache (usually a hidden ⁠.drake/⁠ folder) or NULL.

cache

drake cache. See new_cache(). If supplied, path is ignored.

Details

This function is just like the tempfile() function in base R except that the path points to a special location inside drake's cache. This ensures that if the file needs to be copied to persistent storage in the cache, drake does not need to copy across physical storage media. Example: the "diskframe" format. See the "Formats" and "Columns" sections of the drake_plan() help file. Unless you supply the cache or the path to the cache (see drake_cache()) drake will assume the cache folder is named ⁠.drake/⁠ and it is located either in your working directory or an ancestor of your working directory.

See Also

drake_cache(), new_cache()

Examples

cache <- new_cache(tempfile())
# No need to supply a cache if a .drake/ folder exists.
drake_tempfile(cache = cache)
drake_plan(
  x = target(
    as.disk.frame(large_data, outdir = drake_tempfile()),
    format = "diskframe"
  )
)

wlandau-lilly/drake documentation built on March 6, 2024, 8:18 a.m.