qsavem: qsavem

qsavemR Documentation

qsavem

Description

Saves (serializes) multiple objects to disk.

Usage

qsavem(...)

Arguments

...

Objects to serialize. Named arguments will be passed to qsave() during saving. Un-named arguments will be saved. A named file argument is required.

Details

This function extends qsave() to replicate the functionality of base::save() to save multiple objects. Read them back with qload().

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.