h5Copy {hdf5r.Extra}R Documentation

Copy an HDF5 link

Description

Copy an HDF5 link from one file to another file.

Usage

h5Copy(
  from.file,
  from.name,
  to.file,
  to.name,
  overwrite = FALSE,
  verbose = TRUE,
  ...
)

Arguments

from.file

The source HDF5 file.

from.name

The source link name.

to.file

The target HDF5 file.

to.name

The destination HDF5 link name.

overwrite

Whether or not to overwrite the existing link.

verbose

Print progress.

...

Arguments passed to H5File$obj_copy_from()

Value

This is an operation function and no return. Any failure should raise an error.

Note

See Also

H5File

Examples

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

# Copy a link to a new file
h5Copy(file, "obs", to.file, "obs")
obs <- h5Read(file, "obs")
obs2 <- h5Read(to.file, "obs")
stopifnot(identical(obs, obs2))

# The parent link (H5Group) will be created automatically
h5Copy(file, "obsm/tsne", to.file, "obsm/tsne")
obsm <- h5Read(to.file, "obsm")

# Copy the whole file
x <- h5Read(file)
h5Copy(file, "/", to.file, "/", overwrite = TRUE)
x2 <- h5Read(to.file)
stopifnot(identical(x, x2))


[Package hdf5r.Extra version 0.0.6 Index]