Description Usage Arguments Value Author(s) See Also Examples
(w4mclassfilter support function) Compute variances of rows or columns of a W4M data matrix
1 | w4m__var_by_rank_or_file(m, dim = 1)
|
m |
matrix: W4M data matrix for which variance must be computed for rows or columns |
dim |
integer: For variances of rows, dim == 1, for variances of columns, dim == 2 |
vector of numeric: variances for rows or columns
Art Eschenlauer, esch0041@umn.edu
https://github.com/HegemanLab/w4mclassfilter
http://stackoverflow.com/a/25100036
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | m <- base::matrix(
c(
1, 2, 3,
5, 7, 11,
13, 17, 19
)
, nrow = 3
, ncol = 3
, byrow = TRUE
)
rowvars <- w4m__var_by_rank_or_file(m = m, dim = 1)
expecteds <- c(stats::var(c(1,2,3)),stats::var(c(5,7,11)),stats::var(c(13,17,19)))
base::all.equal(rowvars, expecteds)
colvars <- w4m__var_by_rank_or_file(m = m, dim = 2)
expecteds <- c(stats::var(c(1,5,13)),stats::var(c(2,7,17)),stats::var(c(3,11,19)))
base::all.equal(colvars, expecteds)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.