hdf5_matrix

hdf5_matrix

HDF5MATRIX_CORE

1 Description

Opens an existing dataset in an HDF5 file and returns an HDF5Matrix object that can be used with standard R syntax: dim(), [i,j], \%*\%, crossprod(), and tcrossprod().

2 Usage

hdf5_matrix(filename, path)

3 Arguments

Parameter Description
filename Path to an existing HDF5 file
path Full path to the dataset within the file, in the form or

4 Value

An object

5 Details

The HDF5 file remains open while the object exists, which improves performance for repeated operations. Call $close() to release the file lock explicitly, or use rm() and gc() for automatic cleanup. In an emergency, hdf5_close_all closes all open HDF5Matrix objects.

6 Examples

\donttest{
tmp <- tempfile(fileext = ".h5")

# Create dataset using BigDataStatMeth API
X <- hdf5_create_matrix(tmp, "data/expression",
                         data = matrix(rnorm(200), 20, 10))

dim(X)         # 20 x 10
X[1:5, 1:3]   # subset
crossprod(X)   # t(X) %*% X

close(X)
unlink(tmp)
}

7 See Also