h5Copy: Copy an HDF5 link

View source: R/hdf5-functions.R

h5CopyR 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

  • Copying can still work even if the to.file is actually identical to the from.file.

  • Attributes of from.name will be kept, while those of its parent H5Groups will not.

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")

# 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)


hdf5r.Extra documentation built on Oct. 18, 2024, 9:06 a.m.