retrieve: Retrieve a 'stowed' object.

View source: R/transfer.R

retrieveR Documentation

Retrieve a 'stowed' object.

Description

retrieve will load an object that was previously stowed via stow back to the provided R environment.

Usage

retrieve(
  stowed_object,
  keep_name = FALSE,
  cleanup = FALSE,
  as.data.table = FALSE,
  envir = .GlobalEnv,
  ...
)

Arguments

stowed_object

S3 object created by stow.

keep_name

Logical value; default is FALSE, used if want the object name originally used to be automatically assigned to the provided environment.

cleanup

Logical value; default is FALSE, will remove the object from the hard-drive.

as.data.table

Logical value; if 'fst' method used, returns as a data.table object (requires data.table installed).

envir

Location for imported object to be saved.

...

Additional arguments based to the read function of the respective method.

Details

This function will load an object, initially created by stow, from the hard-drive ('.rds', '.csv', or '.fst' file). retrieve requires the S3 object output from stow in order to load the object. This is to ensure the correct location, name, and method are used. File types of '.rds', '.csv', and '.fst' can be loaded quickly into an R session.

Value

R data object previously stored on hard drive.

Examples

## 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)

al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.