Learn R Programming

hdf5r (version 1.3.3)

H5A-class: Class for representing HDF5 attributes

Description

This class represents an HDF5 attribute. Usually it is easier to read and write attributes for groups, datasets and committed datatypes using the functions documented in h5attributes.

Arguments

Value

Object of class H5A.

Methods

get_info()

This function implements the HDF5-API function H5Aget_info. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_GET_INFO for details.

attr_name()

This function implements the HDF5-API function H5Aget_name. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_GET_NAME for details.

get_space()

This function implements the HDF5-API function H5Aget_space. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_GET_SPACE for details.

get_type(native = TRUE)

This function implements the HDF5-API function H5Aget_type. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_GET_TYPE for details.

get_storage_size()

This function implements the HDF5-API function H5Aget_storage_size. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_GET_STORAGE_SIZE for details.

read_low_level(buffer, mem_type, duplicate_buffer = FALSE)

Only for advanced users. See documentation for read instead. This function implements the HDF5-API function H5Aread. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_READ for details.

read(flags = getOption("hdf5r.h5tor_default"), drop = TRUE)

Reads the data of the attribute and returns it as an R-object

Parameters

flags

Conversion rules for integer values. See also h5const

drop

Logical. Should dimensions of length 1 be dropped (R-default for arrays)

write_low_level(buffer, mem_type)

Only for advanced users. See documentation for write instead. This function implements the HDF5-API function H5Awrite. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5A_WRITE for details.

write(robj, mem_type = NULL, flush = getOption("hdf5r.flush_on_write"))

Writes the data of robj to the attribute

Parameters

robj

The object to write into the attribute

mem_type

The memory data type to use when transferring from HDF5 to intermediate storage. This is an advanced development feature and may be removed in the future.

print(...)

Prints information for the dataset

Parameters

...

ignored

flush(scope = h5const$H5F_SCOPE_GLOBAL)

This function implements the HDF5-API function H5Fflush. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5F_FLUSH for details.

get_filename()

This function implements the HDF5-API function H5Fget_name. Please see the documentation at https://portal.hdfgroup.org/display/HDF5/H5F_GET_NAME for details.

Details

Otherwise, the functionality for attributes is very similar to that of datasets (H5D), however with the notable exception that attributes always have to be read and written as a whole.

Examples

Run this code
# NOT RUN {
fname <- tempfile(fileext = ".h5")
file <- H5File$new(fname, mode = "a")
h5attr(file, "attr_numeric") <- rnorm(10)
a <- file$attr_open("attr_numeric")
a$get_info()
a$attr_name()
a$get_space()
a$get_type()
a$get_storage_size()
a$read()
a$write(10:1)
a$print()
a$close()
file$close_all()
# }

Run the code above in your browser using DataLab