⚠️There's a newer version (1.0.0) of this package. Take me there.

forcats

CRAN_Status_Badge](https://cran.r-project.org/package=forcats)

forcats provides tools for categorical variables (forcats is an anagram of factors).

Installation

You can install the released version of forcats from CRAN with:

install.packages("forcats")

Or the development version from github with:

# install.packages("devtools")
devtools::install_github("hadley/forcats")

Key functions:

Change order of levels:

Change value of levels:

Add new levels:

A few other helpers:

  • fct_c(): concatenate factors using union of levels.

  • fct_count():
    count occurences of levels, optionally sorting by frequency.

  • fct_unify():
    ensure list of factors share the same levels.

  • fct_unique(): compute from levels of factor.

  • fct_drop(): drop levels without data (same as base::droplevels()).

  • lvls_union(): finds union of levels from list of factors.

Copy Link

Version

Down Chevron

Install

install.packages('forcats')

Monthly Downloads

467,996

Version

0.1.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

September 15th, 2016

Functions in forcats (0.1.1)