H5Mat | R Documentation |
For running inmf
, onlineINMF
or
uinmf
with dense matrix stored in HDF5 file, users will need
to construct an argument list for the filename of the HDF5 file as well as
the path in the file storing the matrix. H5Mat
is provided as an
instructed constructor. Meanwhile, since the INMF functions require that
all datasets should be of the same type, as.H5Mat
is provided for
writing in-memory data into a new HDF5 file on disk and returning the
constructed argument list.
H5Mat(filename, dataPath)
as.H5Mat(x, filename, dataPath = "data", overwrite = FALSE, ...)
## S3 method for class 'matrix'
as.H5Mat(x, filename, dataPath = "data", overwrite, ...)
## S3 method for class 'dgCMatrix'
as.H5Mat(x, filename, dataPath = "data", overwrite = FALSE, ...)
## Default S3 method:
as.H5Mat(x, filename, dataPath = "data", ...)
filename |
Filename of the HDF5 file |
dataPath |
Path in the HDF5 file that points to a 2D dense matrix.
Default |
x |
For |
overwrite |
Logical, whether to overwrite the file if already exists at
the given path. Default |
... |
Passed down to hdf5r.Extra::h5Write |
H5Mat object, indeed a list object.
if (require("withr")) {
H5MatEx <- function(){
withr::local_dir(withr::local_tempdir())
h <- H5Mat(system.file("extdata/ctrl_dense.h5", package = "RcppPlanc"),
"data")
print(h)
library(Matrix)
ctrl.dense <- as.matrix(ctrl.sparse)
h1 <- as.H5Mat(ctrl.dense, "ctrl_from_dense_to_dense.h5",
dataPath = "data")
h1
h2 <- as.H5Mat(ctrl.sparse, "ctrl_from_sparse_to_dense.h5",
dataPath = "data")
}
H5MatEx()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.