| [.HDF5Matrix | R Documentation |
Subset an HDF5Matrix
## S3 method for class 'HDF5Matrix'
x[i, j, drop = TRUE, ...]
x |
An |
i |
Row indices: numeric, integer, logical, or missing |
j |
Column indices: numeric, integer, logical, or missing |
drop |
Logical, whether to drop dimensions for single row/column
results (default |
... |
Ignored |
All standard R indexing modes are supported:
Contiguous ranges: X[1:100, 1:50]
Non-contiguous: X[c(1,3,5), c(2,4)]
Negative: X[-c(1,2), ] (all except rows 1 and 2)
Logical: X[row_mask, col_mask]
Missing: X[, ] (entire dataset)
Numeric matrix, or vector when drop = TRUE and one dimension
has length 1
tmp <- tempfile(fileext = ".h5")
X <- hdf5_create_matrix(tmp, "data/matrix", data = matrix(rnorm(100), 10, 10))
X <- hdf5_matrix(tmp, "data/matrix")
X[1:5, 1:3] # submatrix
X[1, ] # single row as vector
X[1, , drop = FALSE] # single row as matrix
X[, 2] # single column as vector
X[-c(1, 10), ] # all except first and last row
X[c(TRUE, FALSE), ] # logical row index
X[, ] # entire dataset
X$close()
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.