rowSums.dist {cba}R Documentation

Row Sums of Sparse Symmetric Matrices

Description

Compute the row (column) sums for a sparse symmetric (distance) matrix.

Usage

rowSums.dist(x, na.rm = FALSE)

Arguments

x an object of class dist.
na.rm logical, should missing values (including NaN) be omitted from the summation?

Details

This function is more efficient than expanding an object of class dist to matrix and using rowSums.

Value

A numeric vector of row sums.

Author(s)

Christian Buchta

See Also

as.matrix, as.dist, and rowSums.

Examples

## 
x <- matrix(runif(10*2),ncol=2)
d <- dist(x)
rowSums(as.matrix(d))
rowSums.dist(d)

[Package cba version 0.2-1 Index]