H5A-class {hdf5r} | R Documentation |
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
.
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.
Value
Object of class H5A
.
Methods
get_info()
-
This function implements the HDF5-API function H5Aget_info. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html for details.
attr_name()
-
This function implements the HDF5-API function H5Aget_name. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html for details.
get_space()
-
This function implements the HDF5-API function H5Aget_space. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html for details.
get_type(native = TRUE)
-
This function implements the HDF5-API function H5Aget_type. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html for details.
get_storage_size()
-
This function implements the HDF5-API function H5Aget_storage_size. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_a.html for details. write(robj, mem_type = NULL, flush = getOption("hdf5r.flush_on_write"))
-
Writes the data of
robj
to the attributeParameters
- 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://docs.hdfgroup.org/hdf5/v1_10/group___h5_f.html for details.
get_filename()
-
This function implements the HDF5-API function H5Fget_name. Please see the documentation at https://docs.hdfgroup.org/hdf5/v1_10/group___h5_f.html for details.
Author(s)
Holger Hoefling
Examples
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()