Wrapper for save() supporting quick, interactive saving of object names passed as symbols.

saveData(..., dir = getOption("acid.save.dir", default = "."),
  ext = getOption("acid.save.ext", default = c("rds", "rda")),
  overwrite = getOption("acid.overwrite", default = TRUE),
  compress = getOption("acid.save.compress", default = TRUE),
  list = NULL, envir = parent.frame())

Arguments

...

Object names. Note that these arguments are interpreted as symbols using non-standard evaluation for convenience during interactive use, and must not be quoted.

dir

character(1). Directory path.

ext

character(1). R data serialized (RDS) or R data (RDA, RDATA). RDS is preferred when saving single objects per file, which is always the convention of saveData(), regardless of the extension used.

overwrite

logical(1). Overwrite existing file on disk.

compress

logical or character string specifying whether saving to a named file is to use compression. TRUE corresponds to gzip compression, and character strings "gzip", "bzip2" or "xz" specify the type of compression. Ignored when file is a connection and for workspace format version 1.

list

character. A character vector containing the names of objects to be saved. Note that this approach differs from save() in that the objects are saved individually to disk, instead of inside a single R data file. Requires objects to be defined in environment specified by envir. argument.

envir

environment. Environment.

Value

Invisible named character. File paths.

Details

This function always saves each object into a separate file rather than combining multiple objects into a single file.

Note

This function is desired for interactive use and interprets object names using non-standard evaluation. It will overwrite existing files on disk, following the same conventions as save().

Updated 2019-07-30.

See also

Examples

dir <- "example" ## Interactive mode ==== ## Note that this method uses non-standard evaluation. a <- 1 b <- 2 saveData(a, b, dir = dir)
#> Saving a.rds, b.rds to /Users/mike/git/packages/brio/docs/reference/example.
#> [1] "a.rds" "b.rds"
## Clean up. unlink(dir, recursive = TRUE) ## List mode ==== ## Note that this method uses standard evaluation. ## Use this approach inside of functions. a <- 1 b <- 2 list <- c("a", "b") saveData(list = list, dir = dir)
#> Saving a.rds, b.rds to /Users/mike/git/packages/brio/docs/reference/example.
#> [1] "a.rds" "b.rds"
## Clean up. unlink(dir, recursive = TRUE)