hdf5.attributes {rhdf5} | R Documentation |
The HDF5 package provides the H5A library for the manipulation of attributes on HDF5 objects.
hdf5.attributes(set) hdf5.attr(set, name) hdf5.attr(set, name) <- value
set |
An object of class hdf5.dataset . |
name |
The name of an attribute (a character string). |
value |
The value to associate with the attribute. |
Even though the HDF5 attributes look a lot like R attributes I do not believe that these functions should become generic. It would make little sense (and a lot of work) to try and syncronize HDF5 attributes and R attributes.
The HDF5 attributes do have the advantage that they are stored with the HDF5 datasets and groups and hence have persistence across R sessions.
For hdf5.attributes
a named list of attributes is returned.
For hdf5.attr
the value of the specific attribute is returned.
For hdf5.attr<-
the value
is returned invisibly.
The following excerpt is taken from the HDF5 online Reference:
The Attribute interface, H5A, is primarily designed to easily allow small datasets to be attached to primary datasets as metadata information. Additional goals for the H5A interface include keeping storage requirement for each attribute to a minimum and easily sharing attributes among datasets.
Because attributes are intended to be small objects, large datasets intended as additional information for a primary dataset should be stored as supplemental datasets in a group with the primary dataset. Attributes can then be attached to the group containing everything to indicate a particular type of dataset with supplemental datasets is located in the group. How small is "small" is not defined by the library and is up to the user's interpretation.
B. Ellis and R. Gentleman
## Not run: mad <- hdf5.open("microarray.h5") hdf5.attributes(mad) hdf5.group(mad,"chip") hdf5.attr(mad$chip, "foo") <- 33 hdf5.attributes(mad$chip) hdf5.attr(mad$chip, "foo") hdf5.attr(mad$chip, "bar") <- "aa" hdf5.attributes(mad$chip) ## End(Not run)