| col_vars | R Documentation |
col_vars computes the sample variance for each column of a numeric matrix.
col_vars(mat, cores = 1)
mat |
A numeric matrix. |
cores |
Number of cores to use for parallel computation. Defaults to 1. |
Variances for columns with one unique value after dropping NA are set to NA.
col_vars returns a named numeric vector of column variances.
mat <- matrix(rnorm(4 * 10), ncol = 4)
mat[1, 1] <- NA
mat[1:8, 2] <- NA
mat[1:9, 3] <- NA
mat[, 4] <- NA
mat
col_vars(mat)
apply(mat, 2, var, na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.