forcats
ππππ: tools for working with categorical variables (factors)
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
βCITATION.cff file
-
βcodemeta.json file
Found codemeta.json file -
β.zenodo.json file
-
βDOI references
-
βAcademic publication links
-
βCommitters with academic emails
4 of 51 committers (7.8%) from academic institutions -
βInstitutional organization owner
-
βJOSS paper metadata
-
βScientific vocabulary similarity
Low similarity (17.4%) to scientific vocabulary
Keywords
factor
r
tidyverse
Keywords from Contributors
package-creation
ropensci
rmarkdown
pandoc
literate-programming
tidy-data
unconf17
unconf
summary-statistics
easy-to-use
Last synced: 6 months ago
·
JSON representation
Repository
ππππ: tools for working with categorical variables (factors)
Basic Info
- Host: GitHub
- Owner: tidyverse
- License: other
- Language: R
- Default Branch: main
- Homepage: https://forcats.tidyverse.org/
- Size: 13.2 MB
Statistics
- Stars: 554
- Watchers: 22
- Forks: 128
- Open Issues: 26
- Releases: 9
Topics
factor
r
tidyverse
Created over 9 years ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
Codeowners
Support
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# forcats
[](https://cran.r-project.org/package=forcats)
[](https://github.com/tidyverse/forcats/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/tidyverse/forcats)
## Overview
R uses __factors__ to handle categorical variables, variables that have a fixed and known set of possible values. Factors are also helpful for reordering character vectors to improve display. The goal of the forcats package is to provide a suite of tools that solve common problems with factors, including changing the order of levels or the values. Some examples include:
* `fct_reorder()`: Reordering a factor by another variable.
* `fct_infreq()`: Reordering a factor by the frequency of values.
* `fct_relevel()`: Changing the order of a factor by hand.
* `fct_lump()`: Collapsing the least/most frequent values of a factor into "other".
You can learn more about each of these in `vignette("forcats")`. If you're new to factors, the best place to start is the [chapter on factors](https://r4ds.hadley.nz/factors.html) in R for Data Science.
## Installation
```
# The easiest way to get forcats is to install the whole tidyverse:
install.packages("tidyverse")
# Alternatively, install just forcats:
install.packages("forcats")
# Or the the development version from GitHub:
# install.packages("pak")
pak::pak("tidyverse/forcats")
```
## Cheatsheet
## Getting started
forcats is part of the core tidyverse, so you can load it with `library(tidyverse)` or `library(forcats)`.
```{r setup, message = FALSE}
library(forcats)
library(dplyr)
library(ggplot2)
```
```{r}
starwars %>%
filter(!is.na(species)) %>%
count(species, sort = TRUE)
```
```{r}
starwars %>%
filter(!is.na(species)) %>%
mutate(species = fct_lump(species, n = 3)) %>%
count(species)
```
```{r unordered-plot}
ggplot(starwars, aes(x = eye_color)) +
geom_bar() +
coord_flip()
```
```{r ordered-plot}
starwars %>%
mutate(eye_color = fct_infreq(eye_color)) %>%
ggplot(aes(x = eye_color)) +
geom_bar() +
coord_flip()
```
## More resources
For a history of factors, I recommend [_stringsAsFactors: An unauthorized biography_](https://simplystats.github.io/2015/07/24/stringsasfactors-an-unauthorized-biography/) by Roger Peng and [_stringsAsFactors = \_](https://notstatschat.tumblr.com/post/124987394001/stringsasfactors-sigh) by Thomas Lumley. If you want to learn more about other approaches to working with factors and categorical data, I recommend [_Wrangling categorical data in R_](https://peerj.com/preprints/3163/), by Amelia McNamara and Nicholas Horton.
## Getting help
If you encounter a clear bug, please file a minimal reproducible example on [Github](https://github.com/tidyverse/forcats/issues). For questions and other discussion, please use [community.rstudio.com](https://community.rstudio.com/).
Owner
- Name: tidyverse
- Login: tidyverse
- Kind: organization
- Website: http://tidyverse.org
- Repositories: 43
- Profile: https://github.com/tidyverse
The tidyverse is a collection of R packages that share common principles and are designed to work together seamlessly
GitHub Events
Total
- Issues event: 17
- Watch event: 7
- Issue comment event: 23
- Push event: 10
- Pull request review event: 1
- Pull request event: 4
- Fork event: 2
- Create event: 1
Last Year
- Issues event: 17
- Watch event: 7
- Issue comment event: 23
- Push event: 10
- Pull request review event: 1
- Pull request event: 4
- Fork event: 2
- Create event: 1
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| hadley | h****m@g****m | 265 |
| Emily Robinson | r****s@g****m | 11 |
| Mara Averick | m****k@g****m | 10 |
| Kirill MΓΌller | k****r | 4 |
| lbouzoubaa | l****a@m****u | 3 |
| Gareth Maddock | 9****9 | 3 |
| Jenny Bryan | j****n@g****m | 3 |
| Kelly N. Bodwin | k****y@b****s | 2 |
| Zhi Yang | 7****g | 2 |
| Yiming (Paul) Li | h****g@g****m | 2 |
| Y. Yu | 5****e | 2 |
| Rafael P. H | r****h | 2 |
| Joyce Robbins | j****3 | 2 |
| Jonathan Carroll | j****o@j****u | 2 |
| Jeremy Stanley | j****y@i****m | 1 |
| Jennifer (Jenny) Bryan | j****y@s****a | 1 |
| Edward Visel | a****e@g****m | 1 |
| Diamantis Sellis | s****d@g****m | 1 |
| David Wilkins | d****d@w****g | 1 |
| David C Hall | d****l | 1 |
| Daniel Possenriede | p****e@g****m | 1 |
| Colin Brislawn | c****l@g****m | 1 |
| Chester Ismay | i****9@g****m | 1 |
| Brian G. Barkley | 1****G | 1 |
| Bill Denney | b****y | 1 |
| Abraham Neuwirth | Y****e | 1 |
| yutannihilation | y****i@g****m | 1 |
| vincent guyader | v****t@g****o | 1 |
| mgacc0 | m****0 | 1 |
| eipi10 | j****l@j****m | 1 |
| and 21 more... | ||
Committer Domains (Top 20 + Academic)
ptt.fi: 1
ed.ac.uk: 1
posteo.de: 1
miamioh.edu: 1
auckland.ac.nz: 1
joelschwartz.com: 1
guyader.pro: 1
wilkox.org: 1
stat.ubc.ca: 1
instacart.com: 1
jcarroll.com.au: 1
bodwin.us: 1
med.miami.edu: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 93
- Total pull requests: 38
- Average time to close issues: 11 months
- Average time to close pull requests: 2 months
- Total issue authors: 62
- Total pull request authors: 17
- Average comments per issue: 1.65
- Average comments per pull request: 0.58
- Merged pull requests: 25
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 9
- Pull requests: 4
- Average time to close issues: 8 months
- Average time to close pull requests: 10 months
- Issue authors: 8
- Pull request authors: 2
- Average comments per issue: 0.33
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- hadley (16)
- DanChaltiel (6)
- davidhodge931 (3)
- dchiu911 (3)
- orgadish (2)
- billdenney (2)
- jpeacock29 (2)
- jwilliman (2)
- sam-crawley (2)
- AlexJHomer (2)
- jennybc (2)
- netique (1)
- brendanjodowd (1)
- xelax (1)
- qutkat (1)
Pull Request Authors
- hadley (18)
- mine-cetinkaya-rundel (2)
- khusmann (2)
- PursuitOfDataScience (2)
- njspix (2)
- Adam-AKong (2)
- sambtalcott (2)
- williamlai2 (1)
- salim-b (1)
- sellisd (1)
- billdenney (1)
- lwjohnst86 (1)
- luisDVA (1)
- DanChaltiel (1)
- malcolmbarrett (1)
Top Labels
Issue Labels
feature (26)
help wanted :heart: (10)
bug (9)
documentation (9)
reprex (2)
tidy-dev-day :nerd_face: (1)
upkeep (1)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 694,363 last-month
- Total docker downloads: 45,962,769
-
Total dependent packages: 315
(may contain duplicates) -
Total dependent repositories: 1,346
(may contain duplicates) - Total versions: 18
- Total maintainers: 1
cran.r-project.org: forcats
Tools for Working with Categorical Variables (Factors)
- Homepage: https://forcats.tidyverse.org/
- Documentation: http://cran.r-project.org/web/packages/forcats/forcats.pdf
- License: MIT + file LICENSE
-
Latest release: 1.0.0
published about 3 years ago
Rankings
Dependent repos count: 0.3%
Dependent packages count: 0.4%
Downloads: 0.4%
Forks count: 0.5%
Stargazers count: 0.7%
Average: 3.3%
Docker downloads count: 17.3%
Maintainers (1)
Last synced:
6 months ago
proxy.golang.org: github.com/tidyverse/forcats
- Documentation: https://pkg.go.dev/github.com/tidyverse/forcats#section-documentation
- License: other
-
Latest release: v1.0.0
published about 3 years ago
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.9%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.4 depends
- cli * imports
- ellipsis * imports
- glue * imports
- lifecycle * imports
- magrittr * imports
- rlang >= 1.0.0 imports
- tibble * imports
- withr * imports
- covr * suggests
- dplyr * suggests
- ggplot2 * suggests
- knitr * suggests
- readr * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action v4.4.1 composite
- actions/checkout v3 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/pr-fetch v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v3 composite
- actions/upload-artifact v3 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite