hdf5_import_multiple

hdf5_import_multiple

HDF5MATRIX_CORE

1 Description

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

2 Usage

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

3 Arguments

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

4 Value

Named list of objects, one for each imported file.

5 Examples

\donttest{
# 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))
}