Open an attribute for an HDF5 object
Arguments
- h5obj
An object of class H5IdComponent representing a H5 object identifier (file, group, or dataset). See
H5Fcreate(),H5Fopen(),H5Gcreate(),H5Gopen(),H5Dcreate(), orH5Dopen()to create an object of this kind.- name
The name of the attribute (character).
- objname
The name of the object the attribute belongs to.
- n
Opens attribute number
nin the given order and index. Indexing is C-style, base-0, so the first attribute is opened withn=0.- index_type
See
h5const("H5_INDEX")for possible arguments.- order
See
h5const("H5_ITER")for possible arguments.
Value
An object of class H5IdComponent representing a H5 attribute identifier.
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)
## open the attribute by name
aid <- H5Aopen(fid, "some_attribute")
H5Aclose(aid)
## open the attribute by name, relative to an object
aid <- H5Aopen_by_name(fid, objname = ".", name = "some_attribute")
H5Aclose(aid)
## open the first (n = 0) attribute attached to the object
aid <- H5Aopen_by_idx(fid, n = 0)
H5Aclose(aid)
H5Fclose(fid)
file.remove(h5File)
#> [1] TRUE