hdf5_import_multiple: Import multiple files into HDF5

View source: R/HDF5Matrix_import.R

hdf5_import_multipleR Documentation

Import multiple files into HDF5

Description

Imports multiple files into the same HDF5 file, each as a separate dataset. Useful for batch importing related datasets.

Usage

hdf5_import_multiple(sources, filename, datasets, ...)

Arguments

sources

Character vector. Paths to files or URLs to import.

filename

Character. Path to HDF5 output file.

datasets

Character vector. Dataset paths for each source file. Must be same length as sources.

...

Additional arguments passed to hdf5_import

Value

Named list of HDF5Matrix objects, one for each imported file.

Examples


# Create temporary CSV files
f1 <- tempfile(fileext = ".csv")
f2 <- tempfile(fileext = ".csv")
f3 <- tempfile(fileext = ".csv")
hdf5_file <- tempfile(fileext = ".h5")

write.table(matrix(rnorm(20), 4, 5), f1, sep = ",",
            row.names = FALSE, col.names = TRUE)
write.table(matrix(rnorm(20), 4, 5), f2, sep = ",",
            row.names = FALSE, col.names = TRUE)
write.table(matrix(rnorm(20), 4, 5), f3, sep = ",",
            row.names = FALSE, col.names = TRUE)

mats <- hdf5_import_multiple(
  sources  = c(f1, f2, f3),
  filename = hdf5_file,
  datasets = c("data/exp1", "data/exp2", "data/exp3"),
  sep      = ","
)

dim(mats$exp1)

hdf5_close_all()
unlink(c(f1, f2, f3, hdf5_file))



BigDataStatMeth documentation built on May 15, 2026, 1:07 a.m.