Learn R Programming

h5 (version 0.9.9)

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, size = -1)

# S4 method for H5Location,character createAttribute(.Object, attributename, data, size = -1)

openAttribute(.Object, attributename)

# S4 method for H5Location,character openAttribute(.Object, attributename)

h5attr(.Object, attributename)

# S4 method for H5Location,character h5attr(.Object, attributename)

h5attr(.Object, attributename, ...) <- value

# S4 method for H5Location,character h5attr(.Object, attributename, ...) <- value

list.attributes(.Object)

# S4 method for H5Location list.attributes(.Object)

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.

size

numeric; Character length for fixed-length string data types. Default value of -1 creates variable-length strings.

...

Additional parameters passed to createAttribute.

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
# NOT RUN {
# 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