Learn R Programming

BigDataStatMeth (version 1.0.3)

bdgetDim_hdf5: Get HDF5 Dataset Dimensions

Description

Retrieves the dimensions (number of rows and columns) of a dataset stored in an HDF5 file.

Usage

bdgetDim_hdf5(filename, dataset)

Value

Integer vector of length 2 containing:

  • [1] Number of rows

  • [2] Number of columns

Arguments

filename

Character string. Path to the HDF5 file.

dataset

Character string. Full path to the dataset within the HDF5 file (e.g., "group/subgroup/dataset").

Details

This function provides efficient access to dataset dimensions in HDF5 files. Key features:

  • Dimension information:

    • Number of rows

    • Number of columns

  • 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

  • bdgetDatasetsList_hdf5 for listing available datasets

  • 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)

# Save matrix to HDF5
bdCreate_hdf5_matrix(fn, X, "data", "matrix1",
                     overwriteFile = TRUE)

# Get dimensions
dims <- bdgetDim_hdf5(fn, "data/matrix1")
print(paste("Rows:", dims[1]))
print(paste("Columns:", dims[2]))

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

Run the code above in your browser using DataLab