Read a dataset or attribute from an HDF file into memory.

Generic helper for reading HDF objects into memory.

hql_read(what = c("DATASET", "ATTRIBUTE"), path, parallel = FALSE)

hql_read_dataset(path, include.attributes = TRUE, parallel = FALSE)

hql_read_attribute(path, parallel = FALSE)

hql_read_all_attributes(path, parallel = FALSE)

Arguments

path

The location of the dataset, attribute, or group within the HDF file.

parallel

Use parallel processing functionality.

include.attributes

If TRUE, include the dataset attributes.

Value

A matrix.

The attribute value.

A named list of attributes.

Functions

  • hql_read_dataset(): Read a dataset from an HDF file.

  • hql_read_attribute(): Read a single attribute from an HDF file.

  • hql_read_all_attributes(): Read attributes from an HDF file.

Examples

if(hql_is_loaded()){
  tf = tempfile(fileext = ".h5")
  hql_create_file(tf)

  hql_use_file(tf)
  x = matrix(rnorm(100), nrow = 20)
  hql_write_dataset(x, "dataset0")
  hql_write_attribute("normal", "dataset0/dist")
 y = month.name
 attr(y, "abbreviation") = month.abb
 attr(y, "number") = 1:12
 hql_write_dataset(y, "group1/dataset1")

hql_read_dataset("dataset0")
hql_read_dataset("group1/dataset1")
hql_read_attribute("group1/dataset1/abbreviation")
hql_read_all_attributes("group1/dataset1")

hql_close_file(tf)
}