Provides dictionaries and a function recode_gender
to allow for easy automatic coding of common variations in free text responses to the question "What is your gender?"
Maintainer: Yaoxiang Li liyaoxiang@outlook.com (ORCID)
Authors:
Jennifer Beaudry jbeaudry@swin.edu.au (ORCID)
Emily Kothe emily.kothe@deakin.edu.au (ORCID)
Felix Singleton Thorn fsingletonthorn@gmail.com (ORCID)
Rhydwyn McGuire rhydwyn@rhydwyn.net
Nicholas Tierney nicholas.tierney@gmail.com (ORCID)
Mathew Ling mathewtyling@gmail.com (ORCID)
Other contributors:
Julia Silge (Julia reviewed the package (v. 0.0.0.9000) for rOpenSci, see <https://github.com/ropensci/software-review/issues/435>) [reviewer]
Elin Waring (Elin reviewed the package (v. 0.0.0.9000) for rOpenSci, see <https://github.com/ropensci/software-review/issues/435>) [reviewer]
Useful links:
Report bugs at https://github.com/ropensci/gendercoder/issues
recode_gender
matches uncleaned gender responses to cleaned list using
an built-in or custom dictionary.
recode_gender( gender, dictionary = gendercoder::manylevels_en, retain_unmatched = FALSE )
recode_gender( gender, dictionary = gendercoder::manylevels_en, retain_unmatched = FALSE )
gender |
a character vector of gender responses for recoding |
dictionary |
a list that the contains gender responses and their
replacement values. A built-in dictionary |
retain_unmatched |
logical indicating if gender responses that are not found in dictionary should be filled with the uncleaned values during recoding |
a character vector of recoded genders
df <- data.frame( stringsAsFactors = FALSE, gender = c("male", "MALE", "mle", "I am male", "femail", "female", "enby"), age = c(34L, 37L, 77L, 52L, 68L, 67L, 83L) ) dplyr::mutate(df, recoded_gender = recode_gender(gender, dictionary = manylevels_en, retain_unmatched = TRUE ))
df <- data.frame( stringsAsFactors = FALSE, gender = c("male", "MALE", "mle", "I am male", "femail", "female", "enby"), age = c(34L, 37L, 77L, 52L, 68L, 67L, 83L) ) dplyr::mutate(df, recoded_gender = recode_gender(gender, dictionary = manylevels_en, retain_unmatched = TRUE ))