View source: R/hdf5-functions.R
h5Copy | R Documentation |
Copy an HDF5 link from one file to another file.
h5Copy(
from.file,
from.name,
to.file,
to.name,
overwrite = FALSE,
verbose = TRUE,
...
)
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 |
This is an operation function and no return. Any failure should raise an error.
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.
H5File
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.