ff_mode {finalfit} | R Documentation |
Return the most frequent level in a factor
Description
When producing conditional estimates from a regression model, it is often useful to set variables not of interest to their mode when creating the newdata object.
Usage
ff_mode(...)
finalfit_mode(...)
Arguments
... |
Unquoted factor names. |
Value
The most frequent level in a factor.
See Also
Examples
library(dplyr)
colon_s %>%
summarise(age.factor = ff_mode(age.factor))
colon_s %>%
select(sex.factor, rx.factor, obstruct.factor, perfor.factor) %>%
summarise(across(everything(), ff_mode))
colon_s %>%
reframe(across(where(is.factor), ff_mode))
# Note, 4 rows is returned in this example because 4 factor levels within `hospital`
# have the same frequency.
[Package finalfit version 1.0.8 Index]