| h5_delete | R Documentation |
Deletes an object (dataset or group) or an attribute from an HDF5 file. If the object or attribute does not exist, a warning is issued and the function returns successfully (no error is raised).
h5_delete(file, name, attr = NULL, warn = TRUE)
file |
The path to the HDF5 file. |
name |
The full path of the object to delete (e.g., |
attr |
The name of the attribute to delete.
|
warn |
Emit a warning if the name/attr does not exist. Default: |
Deleting a dataset also deletes its dimension scales (the datasets holding its
names, dimnames, or row.names), unless another dataset uses them too.
Scales named other than "<name>_..." (such as those other software makes)
are detached but kept. Deleting a dimension scale removes it from the
datasets it labels.
Invisibly returns NULL. This function is called for its side effects.
h5_create_group(), h5_move()
file <- tempfile(fileext = ".h5")
h5_create_file(file)
# Create some data and attributes
h5_write(matrix(1:10, 2, 5), file, "matrix")
h5_write("A note", file, "matrix", attr = "note")
# Review the file structure
h5_str(file)
# Delete the attribute
h5_delete(file, "matrix", attr = "note")
# Review the file structure
h5_str(file)
# Delete the dataset
h5_delete(file, "matrix")
# Review the file structure
h5_str(file)
# Cleaning up
unlink(file)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.