View source: R/filter_low_var.R
| filter_low_var | R Documentation |
Removes numeric columns whose variance (or standard deviation) falls below a specified threshold.
filter_low_var(data, cols = NULL, cutoff = 0.01,
method = "var", verbose = FALSE)
data |
A data frame. |
cols |
Column indices or names of numeric variables to check.
If |
cutoff |
Variance (or standard deviation) threshold. Columns
with statistic |
method |
Statistic to use: |
verbose |
Logical; if |
Variance is computed with NA values removed. For method = "sd",
the standard deviation is compared directly against
cutoff; no internal squaring is performed.
A data frame with low-variance columns removed.
data <- data.frame(
id = 1:100,
const = rep(5, 100),
noise = rnorm(100, sd = 0.005)
)
filter_low_var(data, cutoff = 0.001)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.