Learn R Programming

h5 (version 0.9.1)

H5Location-Attribute: Read and Create Attributes for H5Location Objects

Description

H5Location is the base class of H5File, H5Group and DataSet and implements common methods to create and access attributes for inherited classes.

Usage

createAttribute(.Object, attributename, data)

## S3 method for class 'H5Location,character': createAttribute(.Object, attributename, data)

openAttribute(.Object, attributename)

## S3 method for class 'H5Location,character': openAttribute(.Object, attributename)

h5attr(.Object, attributename)

## S3 method for class 'H5Location,character': h5attr(.Object, attributename)

h5attr(.Object, attributename) <- value

## S3 method for class 'H5Location,character': h5attr(.Object, attributename) <- value

Arguments

.Object
H5Location; S4 object of class H5Location;
attributename
character; Name of attribute to be read/created.
data
object; Data object to be used for attribute creation, can be either of type vector, matrix or array.
value
object; Object to be stored in HDF5 Attribute, can be either of type vector, matrix or array.

See Also

Attribute H5File H5Group DataSet

Examples

Run this code
# Write Attributes for H5File, H5Group and DataSet
file <- H5File("test.h5")
h5attr(file, "fileattrib") <- 1:10
group <- file["testgroup"]
h5attr(group, "groupattrib") <- matrix(1:9, nrow = 3)
h5attr(group, "groupattrib")
group[, "testdataset"] <- 1:10
dset <- group[, "testdataset"]
h5attr(dset, "dsetattrib") <- LETTERS[1:10]
h5close(dset)
h5close(group)
h5close(file)
file.remove("test.h5")

Run the code above in your browser using DataLab