Skip to contents

Check whether an specific attribute exists for an HDF5 object

Usage

H5Aexists(h5obj, name)

Arguments

h5obj

An object of class H5IdComponent representing a H5 object identifier (file, group, or dataset). See H5Fcreate(), H5Fopen(), H5Gcreate(), H5Gopen(), H5Dcreate(), or H5Dopen() to create an object of this kind.

name

The name of the attribute (character).

Value

A logical value indicating whether an attribute with name name exists for the object specified by h5obj.

Examples

h5File <- tempfile(fileext = ".h5")
fid <- H5Fcreate(h5File)
sid <- H5Screate_simple(1)
aid <- H5Acreate(fid, "some_attribute", "H5T_NATIVE_INT", sid)
H5Aclose(aid)
H5Sclose(sid)

H5Aexists(fid, "some_attribute")
#> [1] TRUE
H5Aexists(fid, "not_an_attribute")
#> [1] FALSE

H5Fclose(fid)
file.remove(h5File)
#> [1] TRUE