sparse_Means: RowMens and colMeans for a sparse matrix

Description Usage Arguments Value Examples

View source: R/utils.R

Description

RowMens and colMeans for a sparse matrix

Usage

1
sparse_Means(sparse_matrix, rowMeans = FALSE)

Arguments

sparse_matrix

a sparse matrix

rowMeans

either TRUE or FALSE. If TRUE then the row-means will be calculated, otherwise the column-means

Value

a vector with either the row- or the column-sums of the matrix

Examples

1
2
3
4
5
6
7
library(textTinyR)

tmp = matrix(sample(0:1, 100, replace = TRUE), 10, 10)

sp_mat = dense_2sparse(tmp)

spsm = sparse_Means(sp_mat, rowMeans = FALSE)

textTinyR documentation built on Oct. 26, 2021, 9:06 a.m.