forcats
Forcats is an R package that provides utilities specifically for working with factors, the categorical data type used in R. It is part of the tidyverse collection and is designed to make common factor-related tasks—such as reordering levels, recoding labels, and collapsing infrequent categories—more consistent and expressive than base R methods.
The package offers a range of functions for manipulating factor levels. Key capabilities include reordering levels
Typical use cases involve preparing categorical data for visualization or modeling. For example, one might reorder
Availability and maintenance: forcats is an open-source package available on CRAN and GitHub as part of the