set_fct {framecleaner} | R Documentation |
set factor
Description
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.
Usage
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)
Arguments
.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 |
Value
tibble
Examples
## simply set the first level of a factor
iris$Species %>% levels
iris %>%
set_fct(Species, first_level = "virginica") %>%
dplyr::pull(Species) %>%
levels()
[Package framecleaner version 0.2.1 Index]