h5Backup {hdf5r.Extra}R Documentation

Back up contents from one HDF5 file to another

Description

Function to back up HDF5 file, with optionally excluding specific links.

Usage

h5Backup(
  from.file,
  to.file = NULL,
  exclude = NULL,
  overwrite = FALSE,
  verbose = TRUE,
  ...
)

Arguments

from.file

The source HDF5 file.

to.file

The target HDF5 file. Cannot be the same file as from.file. If NULL, will generate an R temp file.

exclude

Names of HDF5 links not to be backed up.

overwrite

When the to.file already exists, whether or not to overwrite it.

verbose

Print progress.

...

Arguments passed to H5File$obj_copy_from()

Details

When any HDF5 link is to be excluded, it will copy the rest of links from from.file using h5Copy. Otherwise, it will simply copy the from.file to the to.file via file.copy

Value

Path of the to.file

Examples

file <- system.file("extdata", "pbmc_small.h5ad", package = "hdf5r.Extra")
to.file <- tempfile(fileext = ".h5")

h5Backup(file, to.file, exclude = "X")

x <- h5Read(file)
x2 <- h5Read(to.file)
x$X <- NULL # Remove 'X'
stopifnot(identical(x, x2)) # Now these two should be identical


[Package hdf5r.Extra version 0.0.6 Index]