R/utils.R
simulate_sparse_matrix.Rd
Generate a simulated sparse matrix for single-cell data testing
simulate_sparse_matrix(
nrow,
ncol,
density = 0.1,
distribution_fun = function(n) stats::rpois(n, lambda = 0.5) + 1,
seed = 1
)
A sparse matrix of class "dgCMatrix"
simulate_sparse_matrix(2000, 500) |>
check_sparsity()
#> [1] 0.904922