Learn R Programming

h5 (version 0.9.9)

CommonFG: The CommonFG Class

Description

CommonFG is the base class of H5File and H5Group and represents common functionality of these two classes. The CommonFG base class supports various subsetting operators to easily access and manipulate H5Group and DataSet objects (see also CommonFG-Group and CommonFG-DataSet).

Usage

h5close(.Object)

# S4 method for CommonFG,character,ANY [(x, i, j, ..., drop = TRUE)

# S4 method for CommonFG,character,ANY [(x, i, j, ...) <- value

h5unlink(.Object, path)

# S4 method for CommonFG,character h5unlink(.Object, path)

Arguments

.Object

CommonFG; S4 object of class CommonFG;

x

CommonFG; object to be subsetted

i

character; Name of H5Group

j

character; Name of DataSet

...

Additional arguments passed to createDataSet; only relevant for assignment operator.

drop

logical; specify if class of result set should be dropped (not implemented yet).

value

vector/matrix/array; Value to be assigend to dataset

path

character; Path to be deleted, either specifying group or dataset.

Details

Subsetting operators on CommonFG objects represent a convenient way to create/access H5Group and DataSet objects. Currently, only character arguments are supported whereas the first argument specifies the group to be created/accesses and the second the dataset name.

Groups can be created/accessed by simply using one character parameter, e.g. group <- obj["groupname"].

DataSets can be either accessed by using dset <- obj["groupname", "datasetname"] if existing or initialized by using obj["groupname", "datasetname"] <- value.

All created objects e.g. group or dset should be closed in the end using h5close.

See Also

CommonFG-Group CommonFG-DataSet H5Location-Attribute

Examples

Run this code
# NOT RUN {
file <- h5file("test.h5")
# Create new DataSet 'testset' in H5Group 'testgroup'
file["testgroup/testset"] <- matrix(1:9, nrow = 3)
# Create new DataSet 'testset2' in file root
file["testset2"] <- 1:10
# Retrieve H5Group 'testgroup'
group <- file["testgroup"]
# Retrieve DataSet 'testset'
dset <- group["testset"]
h5close(dset)
h5close(group)
h5close(file)
file.remove("test.h5")
# }

Run the code above in your browser using DataLab