qd_serialize: qd_serialize

View source: R/RcppExports.R

qd_serializeR Documentation

qd_serialize

Description

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

Usage

qd_serialize(object,
         compress_level = qopt("compress_level"),
         shuffle = qopt("shuffle"),
         warn_unsupported_types = qopt("warn_unsupported_types"),
         nthreads = qopt("nthreads"))

Arguments

object

The object to save.

compress_level

The compression level used (the initial value is 3L).

The maximum and minimum possible values depend on the version of the 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 (the initial value is TRUE).

warn_unsupported_types

Whether to warn when saving an object with an unsupported type (the initial value is TRUE).

nthreads

The number of threads to use when compressing data (the initial value is 1L).

Value

The serialized object as a raw vector.

Examples

x <- data.frame(int = sample(1e3, replace=TRUE),
         num = rnorm(1e3),
         char = sample(state.name, 1e3, replace=TRUE),
         stringsAsFactors = FALSE)
xserialized <- qd_serialize(x)
x2 <- qd_deserialize(xserialized)
identical(x, x2) # returns TRUE

qs2 documentation built on April 4, 2025, 3:28 a.m.