gender_mutate_df: Inferring Gender from First Names

View source: R/gender_infer.R

gender_mutate_dfR Documentation

Inferring Gender from First Names

Description

This function uses ropensci/gender to convert first names in a dataframe and obtain additional columns from the ropensci/gender outcome. This function complements ropensci/gender to be directly used with dataframes

Usage

gender_mutate_df(
  df,
  input_name,
  years = c(1932, 2012),
  method = "ssa",
  countries = "United States"
)

Arguments

df

Dataframe containing a column of first names

input_name

The name of the column containing first names in given df

years

Which years to use for inferring gender: defaults to 1932-2012.

method

Which method to use for inferring gender: defaults to "ssa".

countries

Which country to use as a baseline: defaults to the U.S.

Examples

df <- data.frame(
  NameFirst = c("Madison", "Nimrodel", "Michael"),
  stringsAsFactors = FALSE
)
gender_mutate_df(df, "NameFirst", years = c(1920, 2010))

sysilviakim/Kmisc documentation built on Jan. 28, 2023, 10:58 a.m.