Learn R Programming

h5lite (version 2.0.0.2)

h5_is_dataset: Check if an HDF5 Object is a Dataset

Description

Checks if the object at a given path is a dataset.

Usage

h5_is_dataset(file, name, attr = NULL)

Value

A logical value: TRUE if the object exists and is a dataset, FALSE otherwise (if it is a group, or does not exist).

Arguments

file

The path to the HDF5 file.

name

The full path of the object to check.

attr

The name of an attribute. If provided, the function returns TRUE if the attribute exists, as all attributes are considered datasets in HDF5 context. (Default: NULL)

See Also

h5_is_group(), h5_exists()

Examples

Run this code
file <- tempfile(fileext = ".h5")

h5_write(1, file, "dset")
h5_is_dataset(file, "dset") # TRUE

h5_create_group(file, "grp")
h5_is_dataset(file, "grp") # FALSE

h5_write(1, file, "grp", attr = "my_attr")
h5_is_dataset(file, "grp", "my_attr") # TRUE

unlink(file)

Run the code above in your browser using DataLab