[1] Male Female Female Male
Levels: Female Male
[1] "Female" "Male"
Lecture 14
College of Idaho
CSCI 2025 - Winter 2026
forcats package (part of tidyverse) provides a suite of tools for working with factors.factor() and fct()levels() shows the categories of the factor.fct_reorder()fct_infreq()fct_relevel()fct_recode(): Changes the names of factor levels.fct_collapse(): Combines several levels into one.fct_lump_*(): lump together the least/most frequent levels into an “Other” category.