% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/recode_gender.R
\name{recode_gender}
\alias{recode_gender}
\title{recode_gender}
\usage{
recode_gender(
  gender,
  dictionary = gendercoder::manylevels_en,
  retain_unmatched = FALSE
)
}
\arguments{
\item{gender}{a character vector of gender responses for recoding}

\item{dictionary}{a list that the contains gender responses and their
replacement values. A built-in dictionary \code{manylevels_en} is used by
default if an alternative dictionary is not supplied.}

\item{retain_unmatched}{logical indicating if gender responses that are not found in
dictionary should be filled with the uncleaned values during recoding}
}
\value{
a character vector of recoded genders
}
\description{
\code{recode_gender} matches uncleaned gender responses to cleaned list using
an built-in or custom dictionary.
}
\examples{


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)
)

df$recoded_gender <- recode_gender(df$gender,
  dictionary = manylevels_en,
  retain_unmatched = TRUE
)
df

}
