Learn R Programming

h5 (version 0.9.9)

DataSet-Subset: Operators to Subset DataSet Objects

Description

DataSet objects can be subsetted to retrieve or write sub--regions as defined by a DataSpace. The subsetting command should be the same to base R subsetting of vectors, matrices or arrays. Also missing subsetting parameters are supported.

Usage

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

# S4 method for DataSet,missing,missing [(x, i, j, ..., drop = TRUE)

# S4 method for DataSet,numeric,missing [(x, i, j, ..., drop = TRUE)

# S4 method for DataSet,missing,numeric [(x, i, j, ..., drop = TRUE)

# S4 method for DataSet,missing,missing [(x, i, j, ...) <- value

# S4 method for DataSet,numeric,missing [(x, i, j, ...) <- value

# S4 method for DataSet,missing,numeric [(x, i, j, ...) <- value

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

Arguments

x

DataSet; S4 object of class DataSet;

i

integer; row index

j

integer; column index

...

additional arguments for subsetting

drop

logical; specify if

value

object; Value to be assigned to dataset

Details

For subset--write operations it has to be noted that no recycling is done by the function and therefore the written object needs to have the same dimensions as the subsetted region.

Examples

Run this code
# NOT RUN {
# Write submatrix to sub-region of DataSet
testmat_n <- matrix(as.integer(1:90), ncol = 9)
file <- h5file("test.h5", "a")
file["testgroup/testmat_n2"] <- testmat_n
submat <- matrix(-1L:-9L, nrow = 3)
dset2 <- file["testgroup/testmat_n2"]
dset2[c(1, 3, 5), c(1, 3, 5)] <- submat
h5close(dset2)
h5close(file)
file.remove("test.h5")
# }

Run the code above in your browser using DataLab