R function to create an HDF5 attribute and defining its dimensionality.
Usage
h5createAttribute(
obj,
attr,
dims,
maxdims = dims,
file,
storage.mode = "double",
H5type = NULL,
size = NULL,
encoding = NULL,
native = FALSE
)Arguments
- obj
The name (character) of the object the attribute will be attached to. For advanced programmers it is possible to provide an object of class H5IdComponent representing a H5 object identifier (file, group, dataset). See
H5Fcreate(),H5Fopen(),H5Gcreate(),H5Gopen(),H5Dcreate(),H5Dopen()to create an object of this kind.- attr
Name of the attribute to be created.
- dims
The dimensions of the attribute as a numeric vector. If
NULL, a scalar dataspace will be created instead.- maxdims
The maximum extension of the attribute.
- file
The filename (character) of the file in which the dataset will be located. For advanced programmers it is possible to provide an object of class H5IdComponent representing an H5 location identifier. See
H5Fcreate(),H5Fopen(),H5Gcreate(),H5Gopen()to create an object of this kind. Thefileargument is not required, if the argumentobjis of typeH5IdComponent.- storage.mode
The storage mode of the data to be written. Can be obtained by
storage.mode(mydata).- H5type
Advanced programmers can specify the datatype of the dataset within the file, either as a string with one of the available datatypes listed in
h5const("H5T"), or as the output ofH5Tcopy(). IfH5typeis specified the argumentstorage.modeis ignored. It is recommended to usestorage.mode.- size
The maximum string length when
storage.mode='character'. If this is specified, HDF5 stores each string ofattras fixed length character arrays. Together with compression, this should be efficient.If this argument is set to
NULL, HDF5 will instead store variable-length strings.- encoding
The encoding of the string data type. Valid options are "ASCII" or "UTF-8".
- native
An object of class
logical. If TRUE, array-like objects are treated as stored in HDF5 row-major rather than R column-major orientation. Usingnative = TRUEincreases HDF5 file portability between programming languages. A file written withnative = TRUEshould also be read withnative = TRUE
Details
Creates a new attribute and attaches it to an existing HDF5 object. The function will fail, if the file doesn't exist or if there exists already another attribute with the same name for this object.
You can use h5writeAttribute() immediately. It will create the attribute
for you.