set_fct | R Documentation |
allows option to manually set the first level of the factor, for consistency with yardstick which automatically considers the first level as the "positive class" when evaluating classification.
set_fct(
.data,
...,
first_level = NULL,
order_fct = FALSE,
labels = NULL,
max_levels = Inf
)
## S3 method for class 'data.frame'
set_fct(.data, ..., first_level = NULL, order_fct = FALSE, max_levels = Inf)
## Default S3 method:
set_fct(.data, ..., first_level = NULL, order_fct = FALSE, max_levels = Inf)
.data |
dataframe |
... |
tidyselect (default selection: all character columns) |
first_level |
character string to set the first level of the factor |
order_fct |
logical. ordered factor? |
labels |
chr vector of labels, length equal to factor levels |
max_levels |
integer. uses |
tibble
## simply set the first level of a factor
iris$Species %>% levels
iris %>%
set_fct(Species, first_level = "virginica") %>%
dplyr::pull(Species) %>%
levels()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.