Learn R Programming

qs2 (version 0.1.4)

qs_serialize: qs_serialize

Description

Serializes an object to a raw vector using the qs2 format.

Usage

qs_serialize(object, compress_level = 3L, shuffle = TRUE, nthreads = 1L)

Value

The serialized object as a raw vector.

Arguments

object

The object to save.

compress_level

The compression level used (default 3).

The maximum and minimum possible values depends on the version of ZSTD library used. As of ZSTD 1.5.6 the maximum compression level is 22, and the minimum is -131072. Usually, values in the low positive range offer very good performance in terms of speed and compression.

shuffle

Whether to allow byte shuffling when compressing data (default: TRUE).

nthreads

The number of threads to use when compressing data (default: 1).

Examples

Run this code
x <- data.frame(int = sample(1e3, replace=TRUE),
        num = rnorm(1e3),
        char = sample(state.name, 1e3, replace=TRUE),
        stringsAsFactors = FALSE)
xserialized <- qs_serialize(x)
x2 <- qs_deserialize(xserialized)
identical(x, x2) # returns true

Run the code above in your browser using DataLab