View source: R/S3_operations.R
| reduce | R Documentation |
Generic function for reducing (accumulating) all datasets in the same HDF5
group as x into a single dataset using a binary operation.
reduce(x, ...)
x |
An |
... |
Additional arguments forwarded to the method. |
A new HDF5Matrix containing the accumulated result.
hdf5_reduce for the standalone group-level version.
fn <- tempfile(fileext = ".h5")
# Create three matrices in the same group
hdf5_create_matrix(fn, "partials/chunk_0", data = matrix(1:100, 10, 10))
hdf5_create_matrix(fn, "partials/chunk_1", data = matrix(1:100, 10, 10))
hdf5_create_matrix(fn, "partials/chunk_2", data = matrix(1:100, 10, 10))
# Open one as entry point — reduce() operates on its whole group
partial <- hdf5_matrix(fn, "partials/chunk_0")
total <- reduce(partial, func = "+")
dim(total)
hdf5_close_all()
unlink(fn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.