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 filefn <-"test.hdf5"X <-matrix(rnorm(100), 10, 10)# Save matrix to HDF5bdCreate_hdf5_matrix(fn, X, "data", "matrix1",overwriteFile =TRUE)# Get dimensionsdims <-bdgetDim_hdf5(fn, "data/matrix1")print(paste("Rows:", dims[1]))print(paste("Columns:", dims[2]))# Cleanupif (file.exists(fn)) {file.remove(fn)}
---title: "bdgetDim_hdf5"subtitle: "bdgetDim_hdf5"---<span class="category-badge hdf5_io_management">HDF5_IO_MANAGEMENT</span>## DescriptionRetrieves the dimensions (number of rows and columns) of a dataset stored inan HDF5 file.## Usage```rbdgetDim_hdf5(filename, dataset)```## Arguments::: {.param-table}| 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"). |:::## Value::: {.return-value}Integer vector of length 2 containing: - \[1\] Number of rows - \[2\] Number of columns:::## DetailsThis 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 filesThe function opens the HDF5 file in read-only mode to ensure data safety.## Examples```{r}#| eval: false#| code-fold: showlibrary(BigDataStatMeth)# Create a test HDF5 filefn <-"test.hdf5"X <-matrix(rnorm(100), 10, 10)# Save matrix to HDF5bdCreate_hdf5_matrix(fn, X, "data", "matrix1",overwriteFile =TRUE)# Get dimensionsdims <-bdgetDim_hdf5(fn, "data/matrix1")print(paste("Rows:", dims[1]))print(paste("Columns:", dims[2]))# Cleanupif (file.exists(fn)) {file.remove(fn)}```## See Also::: {.see-also}- [bdgetDatasetsList_hdf5](bdgetDatasetsList_hdf5.html) for listing available datasets- [bdCreate_hdf5_matrix](bdCreate_hdf5_matrix.html) for creating HDF5 matrices:::