list_datasets

list_datasets

HDF5MATRIX_CORE

1 Description

Lists datasets within an HDF5 file. If no group is specified, the entire file is traversed recursively and full relative paths are returned (e.g. "INPUT/A", "RESULTS/SVD/d"). If a group is given, only the datasets in that group are listed unless recursive = TRUE.

2 Usage

list_datasets(x, group = NULL, prefix = NULL, recursive = FALSE)

3 Arguments

Parameter Description
x An object, or a character string (file path).
group Character or . Group path inside the HDF5 file. If and is a file path, the whole file is listed recursively. If and is an , the object’s own group is used (non-recursive).
prefix Optional character. Only return datasets whose name starts with this prefix.
recursive Logical. If , recurse into subgroups and return full relative paths. Default .

4 Value

Character vector of dataset names or relative paths.

5 Examples

\donttest{
fn <- tempfile(fileext = ".h5")
hdf5_create_matrix(fn, "INPUT/A",    data = matrix(rnorm(100), 10, 10))
hdf5_create_matrix(fn, "INPUT/B",    data = matrix(rnorm(100), 10, 10))
hdf5_create_matrix(fn, "RESULTS/C",  data = matrix(rnorm(100), 10, 10))

# All datasets in the file (recursive from root)
list_datasets(fn)

# Only INPUT group
list_datasets(fn, group = "INPUT")

# From an HDF5Matrix object (uses object's own group)
X <- hdf5_matrix(fn, "INPUT/A")
list_datasets(X)

hdf5_close_all()
unlink(fn)
}

6 See Also