rowSums.dist {cba} | R Documentation |
Compute the row (column) sums for a sparse symmetric (distance) matrix.
rowSums.dist(x, na.rm = FALSE)
x |
an object of class dist . |
na.rm |
logical, should missing values (including NaN ) be
omitted from the summation? |
This function is more efficient than expanding an object of
class dist
to matrix and using rowSums
.
A numeric vector of row sums.
Christian Buchta
as.matrix
, as.dist
, and rowSums
.
## x <- matrix(runif(10*2),ncol=2) d <- dist(x) rowSums(as.matrix(d)) rowSums.dist(d)