-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathREADME.Rmd
98 lines (71 loc) · 3.94 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(dplyr)
```
# gendercoder
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/gendercoder)](https://CRAN.R-project.org/package=gendercoder)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R-CMD-check](https://github.com/ropensci/gendercoder/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/gendercoder/actions)
[![Codecov test coverage](https://codecov.io/gh/ropensci/gendercoder/branch/master/graph/badge.svg)](https://codecov.io/gh/ropensci/gendercoder?branch=master)
[![ROpenSci
status](https://badges.ropensci.org/435_status.svg)](https://github.com/ropensci/software-review/issues/435)
<!-- badges: end -->
The goal of gendercoder is to allow simple re-coding of free-text gender
responses. This is intended to permit representation of gender diversity,
while managing troll-responses and the workload implications of manual coding.
## Installation
This package is not on CRAN. To use this package please run the following code:
``` r
devtools::install_github("ropensci/gendercoder")
library(gendercoder)
```
## Basic use
The gendercoder package permits the efficient re-coding of free-text gender
responses within a tidyverse pipeline. It contains two built-in English output
dictionaries, a default `manylevels_en` dictionary which corrects spelling and
standardises terms while maintaining the diversity of responses and a
`fewlevels_en` dictionary which contains fewer gender categories, "man", "woman",
"boy", "girl", and "sex and gender diverse".
The core function, `gender_recode()`, takes 3 arguments,
- `gender` the vector of free-text gender,
- `dictionary` the preferred dictionary, and
- `retain_unmatched` a logical indicating whether original values should be carried over if
there is no match.
Basic usage is demonstrated below.
```{r}
library(gendercoder)
tibble::tibble(gender = c("male", "MALE", "mle", "I am male", "femail", "female", "enby")) |>
dplyr::mutate(manylevels_gender = recode_gender(gender, dictionary = manylevels_en, retain_unmatched = TRUE),
fewlevels_gender = recode_gender(gender, dictionary = fewlevels_en, retain_unmatched = FALSE)
)
```
The package does not need to be used as part of a tidyverse pipeline:
```{r}
df <- tibble(gender = c("male", "MALE", "mle", "I am male", "femail", "female", "enby"))
df$manylevels_gender <- recode_gender(df$gender, dictionary = manylevels_en)
df
```
## Contributing to this package
This package is a reflection of cultural context of the package contributors.
We acknowledge that understandings of gender are bound by both culture and time
and are continually changing. As such, we welcome issues and pull requests to
make the package more inclusive, more reflective of current understandings of
gender inclusive languages and/or suitable for a broader range of cultural
contexts. We particularly welcome addition of non-English dictionaries or of
other gender-diverse responses to the `manylevels_en` and `fewlevels_en` dictionaries.
The ["Adding to the dictionary"](https://ropensci.github.io/gendercoder/articles/a02_add_dictionary.html) vignette includes information about how to make changes to the dictionary either for your own use or when contributiong to the gendercoder package.
## Acknowledgement of Country
We acknowledge the Wurundjeri people of the Kulin Nation as the custodians of
the land on which this package was developed and pay respects to elders past,
present and future.