stow | R Documentation |
stow
will save an object from the R environment to a location on the hard-drive,
preferably a temporary location (i.e. tempfile
).
stow(
object,
path = NULL,
new_name = NULL,
method = c("rds", "fst", "qs", "csv"),
compress = TRUE,
cleanup = FALSE,
envir = .GlobalEnv,
...
)
object |
Dataset from the R environment; if a list is being stowed, use the 'rds' method. |
path |
Character string, location to stow object on hard-drive, default is |
new_name |
Character string that is used to name the temporary file; default is |
method |
Character string for method of export, either 'rds', 'fst', 'qs', 'csv'; used to determine the file extension. |
compress |
Logical value; default is |
cleanup |
Logical value; default is |
envir |
Location from which to export/cleanup the object of interest; default is |
... |
Additinal arguments based to the write function of the respective method. |
This function will export an object to the hard-drive as a '.rds' or '.fst' file. As such, the 'fst' package is required for this function.
Typically, the purpose of this is to remove a large objects (a few Giga-bytes) from the R session to reclaim RAM and to use retrieve
at the exact time it is required later in a workflow. stow
outputs an object of the S3 class that contains pertinent information on how to
easily retrieve the object. It is recommended to name the output as the same as the object but appended with '_stowed'. The option to output as a 'csv'
file is available to easily stow and pickup in non R workflows.
S3 object of class stow_temp
, to be used when retrieving data.
## Not run:
# Create fake data
temp_data <- data.frame(col1 = rpois(100, 1), col2 = runif(100))
# Stow an object
temp_data_stowed <- stow(object = temp_data, method = 'fst', cleanup = TRUE)
# Retrieve an object
temp_data <- retrieve(stowed_object = temp_data_stowed, cleanup = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.