h5Overwrite: Overwrite an existing HDF5 link

View source: R/hdf5-functions.R

h5OverwriteR Documentation

Overwrite an existing HDF5 link

Description

Overwrite an existing HDF5 link

Usage

h5Overwrite(
  file,
  name,
  overwrite,
  verbose = getOption(x = "h5.overwrite.verbose", default = FALSE)
)

Arguments

file

An existing HDF5 file

name

Name of HDF5 link to be overwritten.

overwrite

Whether or not to overwrite name.

verbose

Print progress.

Details

  • When file doesn't exist, will create it.

  • When the old link name doesn't exist, will simply return file.

  • When name exists and overwrite is TRUE, will copy the rest of HDF5 links to an updated file with h5Backup. If name is "/", will create a new file and overwrite the old one.

  • When name exists and overwrite is FALSE, will raise an error.

Value

Path to file which is ready to be written.

Examples

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

obs <- h5Read(tmp.file, "obs")

h5Overwrite(tmp.file, "layers", TRUE)
h5Exists(tmp.file, "layers")

# You can still read other links.
obs2 <- h5Read(tmp.file, "obs")
identical(obs, obs2)


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