qreadm: qload

Description Usage Arguments Details Value Examples

View source: R/qsavem-load.R

Description

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

Usage

1
2
3

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. 'qloadm' and 'qsavem' are alias of the same function.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
x1 <- data.frame(int = sample(1e3, replace=TRUE), 
                 num = rnorm(1e3), 
                 char = randomStrings(1e3), stringsAsFactors = FALSE)
x2 <- data.frame(int = sample(1e3, replace=TRUE), 
                 num = rnorm(1e3), 
                 char = randomStrings(1e3), 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

Example output

qs v0.23.4.
[1] TRUE
[1] TRUE

qs documentation built on Nov. 6, 2021, 1:07 a.m.

Related to qreadm in qs...