R: Tools for Working with Categorical Variables (Factors)

# Tools for Working with Categorical Variables (Factors)

## Documentation for package ‘forcats’ version 1.0.0

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

as_factor | Convert input to a factor
as_factor.character | Convert input to a factor
as_factor.factor | Convert input to a factor
as_factor.logical | Convert input to a factor
as_factor.numeric | Convert input to a factor
fct | Create a factor
fct_anon | Anonymise factor levels
fct_c | Concatenate factors, combining levels
fct_collapse | Collapse factor levels into manually defined groups
fct_count | Count entries in a factor
fct_cross | Combine levels from two or more factors to create a new factor
fct_drop | Drop unused levels
fct_expand | Add additional levels to a factor
fct_infreq | Reorder factor levels by first appearance, frequency, or numeric order
fct_inorder | Reorder factor levels by first appearance, frequency, or numeric order
fct_inseq | Reorder factor levels by first appearance, frequency, or numeric order
fct_lump | Lump uncommon factor together levels into "other"
fct_lump_lowfreq | Lump uncommon factor together levels into "other"
fct_lump_min | Lump uncommon factor together levels into "other"
fct_lump_n | Lump uncommon factor together levels into "other"
fct_lump_prop | Lump uncommon factor together levels into "other"
fct_match | Test for presence of levels in a factor
fct_na_level_to_value | Convert between 'NA' values and 'NA' levels
fct_na_value_to_level | Convert between 'NA' values and 'NA' levels
fct_other | Manually replace levels with "other"
fct_recode | Change factor levels by hand
fct_relabel | Relabel factor levels with a function, collapsing as necessary
fct_relevel | Reorder factor levels by hand
fct_reorder | Reorder factor levels by sorting along another variable
fct_reorder2 | Reorder factor levels by sorting along another variable
fct_rev | Reverse order of factor levels
fct_shift | Shift factor levels to left or right, wrapping around at end
fct_shuffle | Randomly permute factor levels
fct_unify | Unify the levels in a list of factors
fct_unique | Unique values of a factor, as a factor
first2 | Reorder factor levels by sorting along another variable
gss_cat | A sample of categorical variables from the General Social survey
last2 | Reorder factor levels by sorting along another variable
lvls | Low-level functions for manipulating levels
lvls_expand | Low-level functions for manipulating levels
lvls_reorder | Low-level functions for manipulating levels
lvls_revalue | Low-level functions for manipulating levels
lvls_union | Find all levels in a list of factors