Description Usage Arguments Value Examples
View source: R/variable_select.R
variable_select
selects observation variables based on the specified variable selection method.
1 2 3 4 5 6 7 | variable_select(
population,
variables,
sample = NULL,
operation = "variance_threshold",
...
)
|
population |
tbl with grouping (metadata) and observation variables. |
variables |
character vector specifying observation variables. |
sample |
tbl containing sample that is used by some variable selection methods. |
operation |
optional character string specifying method for variable selection. This must be one of the strings |
... |
arguments passed to selection operation. |
variable-selected data of the same class as population
.
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 | # In this example, we use `correlation_threshold` as the operation for
# variable selection.
suppressMessages(suppressWarnings(library(magrittr)))
population <- tibble::tibble(
x = rnorm(100),
y = rnorm(100) / 1000
)
population %<>% dplyr::mutate(z = x + rnorm(100) / 10)
sample <- population %>% dplyr::slice(1:30)
variables <- c("x", "y", "z")
operation <- "correlation_threshold"
cor(sample)
# `x` and `z` are highly correlated; one of them will be removed
head(population)
futile.logger::flog.threshold(futile.logger::ERROR)
variable_select(population, variables, sample, operation) %>% head()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.