get_fct_lvls | R Documentation |
Given a data frame and a column, the function will return the factor levels.
If unique_lvls = TRUE
, then it will only return the levels for which there
is a value in the data.
get_fct_lvls(data, x, unique_lvls = TRUE)
data |
A data frame or tibble |
x |
Column in the data |
unique_lvls |
Logical. If |
A character vector or NULL
get_fct_lvls(data = iris, x = Species)
iris2 <- subset(iris, Species != "setosa")
table(iris2$Species)
get_fct_lvls(data = iris2, x = Species)
get_fct_lvls(data = iris2, x = Species, unique_lvls = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.