Package 'hdfqlr'

Title: Interface to 'HDFql' API
Description: Provides an interface to 'HDFql' <https://www.hdfql.com/> and helper functions for reading data from and writing data to 'HDF5' files. 'HDFql' provides a high-level language for managing 'HDF5' data that is platform independent. For more information, see the reference manual <https://www.hdfql.com/resources/HDFqlReferenceManual.pdf>.
Authors: Michael Koohafkan [aut, cre]
Maintainer: Michael Koohafkan <[email protected]>
License: GPL (>= 3)
Version: 0.6-2
Built: 2024-12-25 04:56:54 UTC
Source: https://github.com/mkoohafkan/hdfqlr

Help Index


hdfqlr: an HDF API based on HDFql

Description

This package provides an R interface to HDF files using the HDFql.

Package options

hdfqlr uses the following options() to configure behavior:

  • hdfqlr.dir: The HDFql install directory.

Alternatively, the HDFql install directory can be saved to an environment variable HDFQL_DIR.

Author(s)

Maintainer: Michael Koohafkan [email protected]

See Also

Useful links:


HDFql Wrapper Constants and Functions

Description

Access the constants and functions provided by the HDFql wrapper. The wrapper contents are stored in an environment when the HDFql library is loaded and used internally by hdfqlr to perform operations.

Usage

hql

Format

An object of class environment of length 1.

Details

This environment is exported so that users can directly use the HDFql wrapper functions. The intended method of use is to attach() the environment to the search path. For more information on what is provided by the wrapper, consult the HDFql reference manual.

Examples

## Not run: 
  attach(hql$wrapper)

## End(Not run)

Create HDF Files, Datasets or Attribute

Description

Create HDF files and groups.

Usage

hql_create_file(file, overwrite = FALSE, parallel = FALSE)

hql_create_group(group, overwrite = FALSE)

Arguments

file

The HDF file to create.

overwrite

If TRUE, overwrite existing file, group, attribute, or dataset.

parallel

If TRUE, use parallel capabilities.

group

The group to create.

Functions

  • hql_create_file(): Create HDF file.

  • hql_create_group(): Create HDF group.

Examples

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

  hql_use_file(tf)
  hql_create_group("group1")

  hql_close_file(tf)
}

Drop HDF groups, datasets, and attributes

Description

Drop a datset, attribute, or group from an HDF file.

Examples

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

  hql_use_file(tf)
  x = rnorm(10)
  attr(x, "myattribute") = "some information"
  hql_write_dataset(x, "mygroup/mydataset")

  hql_drop_attribute("mygroup/mydataset/myattribute")
  hql_drop_dataset("mygroup/mydataset")
  hql_drop_group("mygroup")
  
  hql_close_file(tf)
}

Access HDF Files

Description

Open (use) and close HDF files.

Usage

hql_use_file(file)

hql_close_file(file, all = FALSE)

Arguments

file

The HDF file path.

all

If TRUE, close all open HDF files.

Functions

  • hql_use_file(): Open (use) an HDF file.

  • hql_close_file(): Close an HDF file.

Examples

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

  hql_use_file(tf)
  hql_flush()

  hql_close_file(tf)
}

Flush HDF Files

Description

Flush HDF file(s) to write buffered data to the disk.

Usage

hql_flush(global = TRUE)

Arguments

global

If TRUE, a global flush is performed and and all open HDF files are flushed. If FALSE, a local flush is performed and only the HDF file currently in use is flushed.


HDFql Library Status

Description

Check if the HDFql library loaded.

Usage

hql_is_loaded()

Value

Logical TRUE if DLLs are found, FALSE otherwise.


List HDF Groups, Datasets or Attributes

Description

List groups, datasets or attribute in an HDF file.

Usage

hql_list_groups(path, recursive = FALSE)

hql_list_datasets(path, recursive = FALSE)

hql_list_attributes(path)

Arguments

path

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

recursive

Recursively list child groups or datasets.

Value

A vector of paths.

Functions

  • hql_list_groups(): List groups.

  • hql_list_datasets(): List datasets.

  • hql_list_attributes(): List Attributes


Load HDFql DLLs

Description

Load the HDFql library.

Usage

hql_load(path)

hql_unload()

Arguments

path

The path to the HDFql installation.

Functions

  • hql_unload(): Unload HDFql Library.


Write HDF Dataset or Attribute

Description

Write a dataset or attribute to an HDF file.

Usage

hql_write_dataset(
  dataset,
  path,
  include.attributes = TRUE,
  overwrite = FALSE,
  parallel = FALSE
)

hql_write_attribute(attribute, path, overwrite = FALSE, parallel = FALSE)

hql_write_all_attributes(attributes, path, overwrite = FALSE, parallel = FALSE)

Arguments

dataset

The dataset to write. The object must be coercible to an array.

path

The location within the HDF file to write the dataset or attribute(s).

include.attributes

If TRUE, write the dataset attributes.

overwrite

If TRUE, overwrite existing dataset or attribute.

parallel

Use parallel processing functionality.

attribute

The attribute to write.

attributes

A list of attributes to write.

Functions

  • hql_write_dataset(): Write a dataset to an HDF file.

  • hql_write_attribute(): Write an attribute to an HDF file.

  • hql_write_all_attributes(): Write multiple attributes to 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
  hql_write_dataset(y, "group1/dataset1")

  hql_close_file(tf)
}