Description Usage Arguments Value Author(s) See Also Examples
Variance estimates for each row (column) in a matrix.
1 2 |
x |
A |
center |
(optional) The center, defaults to the row means. |
na.rm |
If |
... |
Additional arguments passed to |
Returns a numeric
vector
of length N (K).
Henrik Bengtsson
See rowMeans()
and rowSums()
in colSums
().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | set.seed(1)
x <- matrix(rnorm(20), nrow=5, ncol=4)
print(x)
# Row averages
print(rowMeans(x))
print(rowMedians(x))
# Column averages
print(colMeans(x))
print(colMedians(x))
# Row variabilities
print(rowVars(x))
print(rowSds(x))
print(rowMads(x))
print(rowIQRs(x))
# Column variabilities
print(rowVars(x))
print(colSds(x))
print(colMads(x))
print(colIQRs(x))
# Row ranges
print(rowRanges(x))
print(cbind(rowMins(x), rowMaxs(x)))
print(cbind(rowOrderStats(x, 1), rowOrderStats(x, ncol(x))))
# Column ranges
print(colRanges(x))
print(cbind(colMins(x), colMaxs(x)))
print(cbind(colOrderStats(x, 1), colOrderStats(x, nrow(x))))
x <- matrix(rnorm(2400), nrow=50, ncol=40)
# Row standard deviations
d <- rowDiffs(x)
s1 <- rowSds(d)/sqrt(2)
s2 <- rowSds(x)
print(summary(s1-s2))
# Column standard deviations
d <- colDiffs(x)
s1 <- colSds(d)/sqrt(2)
s2 <- colSds(x)
print(summary(s1-s2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.