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 |
This package provides an R interface to HDF files using the HDFql.
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
.
Maintainer: Michael Koohafkan [email protected]
Useful links:
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.
hql
hql
An object of class environment
of length 1.
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.
## Not run: attach(hql$wrapper) ## End(Not run)
## Not run: attach(hql$wrapper) ## End(Not run)
Create HDF files and groups.
hql_create_file(file, overwrite = FALSE, parallel = FALSE) hql_create_group(group, overwrite = FALSE)
hql_create_file(file, overwrite = FALSE, parallel = FALSE) hql_create_group(group, overwrite = FALSE)
file |
The HDF file to create. |
overwrite |
If |
parallel |
If |
group |
The group to create. |
hql_create_file()
: Create HDF file.
hql_create_group()
: Create HDF group.
if(hql_is_loaded()) { tf = tempfile(fileext = ".h5") hql_create_file(tf) hql_use_file(tf) hql_create_group("group1") hql_close_file(tf) }
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 a datset, attribute, or group from an HDF file.
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) }
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) }
Open (use) and close HDF files.
hql_use_file(file) hql_close_file(file, all = FALSE)
hql_use_file(file) hql_close_file(file, all = FALSE)
file |
The HDF file path. |
all |
If |
hql_use_file()
: Open (use) an HDF file.
hql_close_file()
: Close an HDF file.
if(hql_is_loaded()){ tf = tempfile(fileext = ".h5") hql_create_file(tf) hql_use_file(tf) hql_flush() hql_close_file(tf) }
if(hql_is_loaded()){ tf = tempfile(fileext = ".h5") hql_create_file(tf) hql_use_file(tf) hql_flush() hql_close_file(tf) }
Flush HDF file(s) to write buffered data to the disk.
hql_flush(global = TRUE)
hql_flush(global = TRUE)
global |
If |
Check if the HDFql library loaded.
hql_is_loaded()
hql_is_loaded()
Logical TRUE
if DLLs are found, FALSE
otherwise.
List groups, datasets or attribute in an HDF file.
hql_list_groups(path, recursive = FALSE) hql_list_datasets(path, recursive = FALSE) hql_list_attributes(path)
hql_list_groups(path, recursive = FALSE) hql_list_datasets(path, recursive = FALSE) hql_list_attributes(path)
path |
The location of the dataset, attribute, or group within the HDF file. |
recursive |
Recursively list child groups or datasets. |
A vector of paths.
hql_list_groups()
: List groups.
hql_list_datasets()
: List datasets.
hql_list_attributes()
: List Attributes
Load the HDFql library.
hql_load(path) hql_unload()
hql_load(path) hql_unload()
path |
The path to the HDFql installation. |
hql_unload()
: Unload HDFql Library.
Write a dataset or attribute to an HDF file.
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)
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)
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 |
overwrite |
If |
parallel |
Use parallel processing functionality. |
attribute |
The attribute to write. |
attributes |
A list of attributes to write. |
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.
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) }
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) }