bdgetDim_hdf5

HDF5_IO_MANAGEMENT

1 Description

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

2 Usage

bdgetDim_hdf5(filename, dataset)

3 Arguments

Parameter Description
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”).

4 Value

Integer vector of length 2 containing: - [1] Number of rows - [2] Number of columns

5 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.

6 Examples

Code
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)
}

7 See Also