qread {qs} | R Documentation |
qread
Description
Reads an object in a file serialized to disk.
Usage
qread(file, use_alt_rep=FALSE, strict=FALSE, nthreads=1)
Arguments
file |
The file name/path. |
use_alt_rep |
Use ALTREP when reading in string data (default |
strict |
Whether to throw an error or just report a warning (default: |
nthreads |
Number of threads to use. Default |
Value
The de-serialized object.
Examples
x <- data.frame(int = sample(1e3, replace=TRUE),
num = rnorm(1e3),
char = sample(starnames$`IAU Name`, 1e3, replace=TRUE),
stringsAsFactors = FALSE)
myfile <- tempfile()
qsave(x, myfile)
x2 <- qread(myfile)
identical(x, x2) # returns true
# qs support multithreading
qsave(x, myfile, nthreads=2)
x2 <- qread(myfile, nthreads=2)
identical(x, x2) # returns true
# Other examples
z <- 1:1e7
myfile <- tempfile()
qsave(z, myfile)
z2 <- qread(myfile)
identical(z, z2) # returns true
w <- as.list(rnorm(1e6))
myfile <- tempfile()
qsave(w, myfile)
w2 <- qread(myfile)
identical(w, w2) # returns true
[Package qs version 0.26.3 Index]