Lists the names of objects (datasets and groups) within an HDF5 file or group.
Arguments
- file
Path to the HDF5 file.
- name
The group path to start listing from. Defaults to the root group (
/).- recursive
If
TRUE(default), lists all objects found recursively undername. IfFALSE, lists only the immediate children.- full.names
If
TRUE, the full paths from the file's root are returned. IfFALSE(the default), names are relative toname.
Value
A character vector of object names. If name is / (the default),
the paths are relative to the root of the file. If name is another group,
the paths are relative to that group (unless full.names = TRUE).
Examples
file <- tempfile(fileext = ".h5")
# Create some nested objects
h5_write(file, "g1/d1", 1)
h5_write(file, "g1/g2/d2", 2)
# List recursively from the root (default)
h5_ls(file) # c("g1", "g1/d1", "g1/g2", "g1/g2/d2")
#> [1] "g1" "g1/d1" "g1/g2" "g1/g2/d2"
# List recursively from a subgroup
h5_ls(file, name = "g1") # c("d1", "g2", "g2/d2")
#> [1] "d1" "g2" "g2/d2"
unlink(file)
