ezLoadRobj: Load R objects from various serialized formats

View source: R/util.R

ezLoadRobjR Documentation

Load R objects from various serialized formats

Description

This function loads R objects from files with different extensions (.qs2, .qs, .rds) by automatically detecting the file format based on the extension.

Usage

ezLoadRobj(filePath, nthreads = 1L)

Arguments

filePath

Character string specifying the path to the R object file.

nthreads

Integer specifying how many threads to use for qs/qs2 loading. Default is 1.

Details

The function checks if the required packages are available (qs2, qs) and loads the appropriate package for the file extension. Supported formats:

  • .qs2 - Uses qs2::qread() for fastest serialization

  • .qs - Uses qs::qread() for fast serialization

  • .rds - Uses base::readRDS() for standard R serialization

Value

The R object stored in the file.

Author(s)

Rehrauer, Hubert

Schmid, Peter

Examples

## Not run: 
# Load a qs2 file
my_object <- ezLoadRobj("path/to/data.qs2", nthreads=4L)

# Load a qs file
my_object <- ezLoadRobj("path/to/data.qs", nthreads=3L)

# Load an rds file
my_object <- ezLoadRobj("path/to/data.rds")

## End(Not run)

uzh/ezRun documentation built on June 14, 2025, 1:29 p.m.