Skip to content

ropensci/gendercoder

Repository files navigation

gendercoder

gendercoder hex sticker

CRAN status Lifecycle: stable Project Status: Active - The project has reached a stable, usable state and is being actively developed. R-CMD-check Codecov test coverage

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:

devtools::install_github("ropensci/gendercoder")
library(gendercoder)

Basic use

The gendercoder package permits the efficient re-coding of free-text gender responses. 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, recode_gender(), 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.

library(gendercoder)

df <- data.frame(
  stringsAsFactors = FALSE,
  gender = c("male", "MALE", "mle", "I am male", "femail", "female", "enby")
)

df$manylevels_gender <- recode_gender(
  df$gender,
  dictionary = manylevels_en,
  retain_unmatched = TRUE
)
df$fewlevels_gender <- recode_gender(
  df$gender,
  dictionary = fewlevels_en,
  retain_unmatched = FALSE
)
df
#> Results not matched from the dictionary have been filled with the user inputted values
#>      gender manylevels_gender       fewlevels_gender
#> 1      male               man                    man
#> 2      MALE               man                    man
#> 3       mle               man                    man
#> 4 I am male         I am male                   <NA>
#> 5    femail             woman                  woman
#> 6    female             woman                  woman
#> 7      enby        non-binary sex and gender diverse

The package also includes a local Shiny app for interactive recoding:

gendercoder_app()

The app accepts .csv, .dta, .sav, .rds, .rda, and .RData files. It displays the selected gender column and the recoded output column, then lets you download the full recoded data.

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" vignette includes information about how to make changes to the dictionary either for your own use or when contributiong to the gendercoder package.

Citation Information

Please cite this package as:

Jennifer Beaudry, Emily Kothe, Felix Singleton Thorn, Rhydwyn McGuire, Nicholas Tierney and Mathew Ling (2020). gendercoder: Recodes Sex/Gender Descriptions into a Standard Set. R package version 0.0.0.9000. https://github.com/ropensci/gendercoder

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.

About

Creating R package to code free text gender responses

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages