h5createAttribute: Create HDF5 attribute

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

R function to create an HDF5 attribute and defining its dimensionality.

Usage

1
2
h5createAttribute (obj, attr, dims, maxdims = dims, file, 
                   storage.mode = "double", H5type = NULL, size=NULL)

Arguments

obj

The name (character) of the object the attribute will be attatched 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.

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 representig an H5 location identifier. See H5Fcreate, H5Fopen, H5Gcreate, H5Gopen to create an object of this kind. The file argument is not required, if the argument obj is of type H5IdComponent.

attr

Name of the attribute to be created.

dims

The dimension of the attribute.

maxdims

The maximum extension of the attribute.

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. See h5const("H5T") for a list of available datatypes. If H5type is specified the argument storage.mode is ignored. It is recommended to use storage.mode

size

For storage.mode='character' the maximum string length has to be specified. HDF5 then stores the string as fixed length character vectors. Together with compression, this should be efficient.

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.

Value

Returns TRUE is attribute was created successfully and FALSE otherwise.

Author(s)

Bernd Fischer

References

http://www.hdfgroup.org/HDF5

See Also

h5createFile, h5createGroup, h5createDataset, h5read, h5write, rhdf5

Examples

1
2
3
4
5
6
7
h5createFile("ex_createAttribute.h5")
h5write(1:1, "ex_createAttribute.h5","A")
fid <- H5Fopen("ex_createAttribute.h5")
did <- H5Dopen(fid, "A")
h5createAttribute (did, "time", c(1,10))
H5Dclose(did)
H5Fclose(fid)

patperry/rhdf5 documentation built on May 24, 2019, 8:21 p.m.