qreadm: qload

View source: R/qsavem-load.R

qreadmR Documentation

qload

Description

Reads an object in a file serialized to disk using qsavem().

Usage

qreadm(file, env = parent.frame(), ...)

qload(file, env = parent.frame(), ...)

Arguments

file

The file name/path.

env

The environment where the data should be loaded.

...

additional arguments will be passed to qread.

Details

This function extends qread to replicate the functionality of base::load() to load multiple saved objects into your workspace. qload and qreadm are alias of the same function.

Value

Nothing is explicitly returned, but the function will load the saved objects into the workspace.

Examples

x1 <- data.frame(int = sample(1e3, replace=TRUE),
                 num = rnorm(1e3),
                 char = sample(starnames$`IAU Name`, 1e3, replace=TRUE),
                 stringsAsFactors = FALSE)
x2 <- data.frame(int = sample(1e3, replace=TRUE),
                 num = rnorm(1e3),
                 char = sample(starnames$`IAU Name`, 1e3, replace=TRUE),
                 stringsAsFactors = FALSE)
myfile <- tempfile()
qsavem(x1, x2, file=myfile)
rm(x1, x2)
qload(myfile)
exists('x1') && exists('x2') # returns true

# qs support multithreading
qsavem(x1, x2, file=myfile, nthreads=2)
rm(x1, x2)
qload(myfile, nthreads=2)
exists('x1') && exists('x2') # returns true

qs documentation built on Oct. 2, 2024, 1:07 a.m.