Skip to contents

Attempts to turn a dgCMatrix into a dense matrix

Usage

as_matrix(x)

Arguments

x

A matrix.

Examples

data("pancreas_sub")
system.time(mat1 <- as.matrix(slot(pancreas_sub[["RNA"]], "counts")))
#>    user  system elapsed 
#>   0.855   0.047   0.901 
system.time(mat2 <- as_matrix(slot(pancreas_sub[["RNA"]], "counts")))
#>    user  system elapsed 
#>   0.009   0.012   0.020 
identical(mat1, mat2)
#> [1] TRUE