qread: qread

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Reads an object in a file serialized to disk

Usage

1
qread(file, use_alt_rep=FALSE, strict=FALSE, nthreads=1)

Arguments

file

the file name/path

use_alt_rep

Use alt rep when reading in string data. Default: FALSE. (Note: on R versions earlier than 3.5.0, this parameter does nothing.)

strict

Whether to throw an error or just report a warning (Default: FALSE, report warning)

nthreads

Number of threads to use. Default 1.

Value

The de-serialized object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
x <- data.frame(int = sample(1e3, replace=TRUE), 
        num = rnorm(1e3), 
        char = randomStrings(1e3), 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

Example output

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

qs documentation built on July 25, 2021, 5:08 p.m.

Related to qread in qs...