as_matrix {thisutils} | R Documentation |
Convert sparse matrix into dense matrix
Description
Convert sparse matrix into dense matrix
Usage
as_matrix(x, parallel = FALSE, sparse = FALSE)
Arguments
x |
A matrix. |
parallel |
Logical value, default is |
sparse |
Logical value, default is |
Value
A dense or sparse matrix
Examples
m <- simulate_sparse_matrix(
1000, 1000,
decimal = 3
)
system.time(
a <- as.matrix(m)
)
system.time(
b <- as_matrix(m)
)
system.time(
c <- as_matrix(m, parallel = TRUE)
)
system.time(
d <- as_matrix(m, sparse = TRUE)
)
m[1:5, 1:5]
a[1:5, 1:5]
b[1:5, 1:5]
c[1:5, 1:5]
identical(a, b)
identical(a, c)
identical(b, c)
identical(a, d)
identical(b, d)
[Package thisutils version 0.0.7 Index]