Skip to contents

This function reads a dataset from an existing HDF5 file.

Usage

read_hdf5_dataset(file_name, dataset_name)

Arguments

file_name

A character string specifying the path to the HDF5 file.

dataset_name

A character string specifying the name of the dataset within the HDF5 file to read.

Value

The content of the dataset from the HDF5 file, typically in the form of an R object.

Examples

data_to_write <- 1:10

# Create an empty HDF5 file
hdf5_file <- tempfile()
create_hdf5_file(hdf5_file)

# Write new data to a dataset in the HDF5 file
write_hdf5_dataset(hdf5_file, "group/dataset", data_to_write)

# Read a dataset from an HDF5 file
hdf5_data <- read_hdf5_dataset(hdf5_file, "group/dataset")
print(hdf5_data)
#>  [1]  1  2  3  4  5  6  7  8  9 10