simple: Saving simple seed classes

saveDelayedObject,array-methodR Documentation

Saving simple seed classes

Description

Methods to save simple seed classes - namely, ordinary matrices or sparse Matrix objects - into the delayed operation file. See “Dense arrays” and “Sparse matrices” at https://artifactdb.github.io/chihaya/ for more details.

Usage

## S4 method for signature 'array'
saveDelayedObject(x, file, name)

## S4 method for signature 'CsparseMatrix'
saveDelayedObject(x, file, name)

Arguments

x

An R object of the indicated class.

file

String containing the path to a HDF5 file.

name

String containing the name of the group to save into.

Details

For string arrays, missing values are handled by the "missing-value-placeholder" attribute on the data dataset. All NA values in the array are replaced by the placeholder value in the attribute when they are saved inside the HDF5 file. If this attribute is not present, it can be assumed that all strings are non-missing.

Value

A NULL, invisibly. A group is created at name containing the contents of x.

Author(s)

Aaron Lun

Examples

# Saving an ordinary matrix.
X <- matrix(rpois(100, 2), 5, 20)
Y <- DelayedArray(X)
temp <- tempfile(fileext=".h5")
saveDelayed(Y, temp)
rhdf5::h5ls(temp)
loadDelayed(temp)

# Saving a sparse matrix.
X <- rsparsematrix(100, 20, 0.1)
Y <- DelayedArray(X)
temp <- tempfile(fileext=".h5")
saveDelayed(Y, temp)
rhdf5::h5ls(temp)
loadDelayed(temp)


LTLA/DelayedArraySaver documentation built on Sept. 19, 2024, 1:37 p.m.