sparse_Sums: RowSums and colSums for a sparse matrix

View source: R/utils.R

sparse_SumsR Documentation

RowSums and colSums for a sparse matrix

Description

RowSums and colSums for a sparse matrix

Usage

sparse_Sums(sparse_matrix, rowSums = FALSE)

Arguments

sparse_matrix

a sparse matrix

rowSums

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

Value

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

Examples


library(textTinyR)

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

sp_mat = dense_2sparse(tmp)

spsm = sparse_Sums(sp_mat, rowSums = FALSE)

mlampros/textTinyR documentation built on Jan. 17, 2024, 1:18 a.m.