View source: R/detect_const_cols.R
detect_const_cols | R Documentation |
It occasionally happens that a column in dataframe contains a single value throughout. This could lead to redundant computational cost and unexpected behavior in Machine Learning methods. This function scans though all columns of dataframe to examine if any column has no variation.
detect_const_cols(dataset, return_type = "col_names", ignore_na = F)
dataset |
A data.frame |
return_type |
How to return detected constant columns Use "col_names", "col_positions" or "dataset" to return dataset with deleted constant columns |
ignore_na |
Whether NA should be ignored while checking if a column has just 1 unique value |
. A vector of constant column-names or column positions or dataset with deleted constant columns. Use return_type parameter to specify.
## Not run: detect_const_cols(dataset = head(mutate(mtcars, mpg_2 = 999))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.