Learn R Programming

BigDataStatMeth (version 1.0.3)

bdgetDatasetsList_hdf5: List Datasets in HDF5 Group

Description

Retrieves a list of all datasets within a specified HDF5 group, with optional filtering by prefix or suffix.

Usage

bdgetDatasetsList_hdf5(filename, group, prefix = NULL)

Value

Character vector containing dataset names.

Arguments

filename

Character string. Path to the HDF5 file.

group

Character string. Path to the group within the HDF5 file.

prefix

Optional character string. If provided, only returns datasets starting with this prefix.

Details

This function provides flexible dataset listing capabilities for HDF5 files. Key features:

  • Listing options:

    • All datasets in a group

    • Datasets matching a prefix

    • Datasets matching a suffix

  • Implementation features:

    • Safe HDF5 file operations

    • Memory-efficient implementation

    • Comprehensive error handling

    • Read-only access to files

The function opens the HDF5 file in read-only mode to ensure data safety.

References

  • The HDF Group. (2000-2010). HDF5 User's Guide.

See Also

  • bdCreate_hdf5_matrix for creating HDF5 matrices

Examples

Run this code
if (FALSE) {
library(BigDataStatMeth)

# Create a test HDF5 file
fn <- "test.hdf5"
X <- matrix(rnorm(100), 10, 10)
Y <- matrix(rnorm(100), 10, 10)

# Save matrices to HDF5
bdCreate_hdf5_matrix(fn, X, "data", "matrix1",
                     overwriteFile = TRUE)
bdCreate_hdf5_matrix(fn, Y, "data", "matrix2",
                     overwriteFile = FALSE)

# List all datasets in group
datasets <- bdgetDatasetsList_hdf5(fn, "data")
print(datasets)

# List datasets with prefix "matrix"
filtered <- bdgetDatasetsList_hdf5(fn, "data", prefix = "matrix")
print(filtered)

# Cleanup
if (file.exists(fn)) {
  file.remove(fn)
}
}

Run the code above in your browser using DataLab