by Hadley Wickham

Monthly downloads



License GPL-3
Encoding UTF-8
LazyData true
RoxygenNote 5.0.1
NeedsCompilation no
Packaged 2016-09-15 20:18:13 UTC; hadley
Repository CRAN
Date/Publication 2016-09-16 00:15:04

Tools for Working with Categorical Variables (Factors)

Helpers for reordering factor levels (including moving specified levels to front, ordering by first appearance, reversing, and randomly shuffling), and tools for modifying factor levels (including collapsing rare levels into other, 'anonymising', and manually 'recoding').
Full Readme

Functions in forcats

Name Description
fct_expand Add additional levels to a factor
fct_collapse Collapse factors into groups.
fct_explicit_na Make missing values explicit
fct_inorder Reorders levels in order of first appearance or frequency.
fct_count Count entries in a factor
fct_c Concatenate factors, unioning levels.
fct_recode Change the levels of a factor
fct_lump Lump together least/most common levels into "other".
fct_anon Anonymise factor levels
fct_drop Drop unnused levels
fct_rev Reverse the levels of a factor
lvls Low-level functions for manipulating levels
fct_shift Shift the order of levels of a factor
lvls_union Find all levels in a list of factors
fct_relevel Change the order of levels in a factor
fct_shuffle Randomly permute the levels of a factor
fct_reorder Reorder the levels of a function according to another variable
fct_unify Unify the levels in a list of factors
fct_unique Unique values of a factor
gss_cat A sample of categorical variables from the General Social survey
%>% Pipe operator
No Results!


Get your badge !