if (require("withr")) {
H5SpMatEx <- function() {
withr::local_dir(withr::local_tempdir())
h <- H5SpMat(system.file("extdata/ctrl_sparse.h5", package = "RcppPlanc"),
"scaleDataSparse/data", "scaleDataSparse/indices", "scaleDataSparse/indptr", 173, 300)
dim(h)
library(Matrix)
ctrl.dense <- as.matrix(ctrl.sparse)
h1 <- as.H5SpMat(ctrl.sparse, "ctrl_from_sparse_to_sparse.h5", "matrix")
h1
h2 <- as.H5SpMat(ctrl.dense, "ctrl_from_dense_to_sparse.h5", "matrix")
h2
}
H5SpMatEx()
}
Run the code above in your browser using DataLab