Selecting and assigning subsets of HDF5-Spaces and HDF5-Datasets

subset_h5.H5S(x, d1, ..., op = h5const$H5S_SELECT_SET,
  envir = parent.frame())

# S3 method for class 'H5S'
`[`(x, d1, ..., op = h5const$H5S_SELECT_SET,
  envir = parent.frame())

subset_h5.H5D(x, d1, ..., dataset_xfer_pl = h5const$H5P_DEFAULT,
  flags = getOption("hdf5r.h5tor_default"), drop = TRUE,
  envir = parent.frame())

# S3 method for class 'H5D'
`[`(x, d1, ..., dataset_xfer_pl = h5const$H5P_DEFAULT,
  flags = getOption("hdf5r.h5tor_default"), drop = TRUE,
  envir = parent.frame())

subset_assign_h5.H5D(x, d1, ..., dataset_xfer_pl = h5const$H5P_DEFAULT,
  envir = parent.frame(), value)

# S3 method for class 'H5D'
`[`(x, d1, ..., dataset_xfer_pl = h5const$H5P_DEFAULT,
  envir = parent.frame()) <- value

Arguments

x

The H5S or H5D to subset or assign values to

d1

First dimension of the object

...

Used for other dimension of the object

op

Operation to perform on the H5S. Look into the HDF5 online help https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html and https://docs.hdfgroup.org/hdf5/v1_10/group___h5_s.html

envir

The environment in which the dimension indices d1, ... are to be evaluated. Usually the environment from where the function is called

dataset_xfer_pl

An object of class H5P_DATASET_XFER.

flags

Some flags governing edge cases of conversion from HDF5 to R. This is related to how integers are being treated and the issue of R not being able to natively represent 64bit integers and not at all being able to represent unsigned 64bit integers (even using add-on packages). The constants governing this are part of h5const. The relevant ones start with the term H5TOR and are documented there. The default set here returns a regular 32bit integer if it doesn't lead to an overflow and returns a 64bit integer from the bit64 package otherwise. For 64bit unsigned int that are larger than 64bit signed int, it return a double. This looses precision, however. See also documentation or h5const.

drop

Logical. When reading data, should dimensions of size 1 be dropped.

value

The value to assign to the dataset

Value

For x being a H5S, the same object is returned, but with the selection set as requested. For H5D it retrieves the subset of data requested or sets the subset of data assigned, as for any n-dimensional array in R.

Details

Used for subsetting HDF5-Datasets or HDF5-Spaces or for assigning data into HDF5-Datasets. There are some differences to consider with R itself.

Most importantly HDF5-COMPOUND objects only have a single dimension internally to HDF5 (a vector), but they correspond to R-data.frames, which are 2 dimensional. For an HDF5 COMPOUND object, it is currently not possible to only sub-select a specific column. All columns have to be extracted (using 1-dimensional access with [ and can then be subset in R itself. The same is true for writing a COMPOUND object (H5T_COMPOUND). A complete data-frame is needed, not just a subset of the columns.

Another important differences is for datasets of HDF5-ARRAY type H5T_ARRAY where the access to the object is only for the dimension of the object itself, not including the dimensions of the underlying array type.

Author

Holger Hoefling