gen_firstname: Randomly generate a firstname.

Description Usage Arguments Value Examples

View source: R/name.R

Description

gen_firstname randomly sample a firstname from the selected database:

  1. country If is 'uk', the function will automatically sample a firstname that based on the gender and birthyear. The uk firstname database was extracted from https://www.ons.gov.uk/peoplepopulationandcommunity/birthsdeathsandmarriages/livebirths/bulletins/babynamesenglandandwales/2018/relateddata containing firstnames and their frequencies in England and Wales from 1996 to 2018.

  2. If country is 'us', the function will automatically sample a firstname that based on the gender and race. The us firstname database was extracted from randomNamesData.

Usage

1
gen_firstname(country = "uk", gender = NA, birthyear = NA, race = NA)

Arguments

country

A string variable with a default of 'uk'. It is either 'uk' or 'us'.

gender

A string variable either 'male' or 'female'.

birthyear

A number from 1996 to 2018. For number smaller than 1996 will assumes as 1996 and greater than 2018 will assumes aas 2018.

race

A number or a string of the ethnicity code: 1 American Indian or Native Alaskan, 2 Asian or Pacific Islander, 3 Black (not Hispanic), 4 Hispanic, 5 White (not Hispanic) and 6 Middle-Eastern, Arabic.

Value

A name string.

Examples

1
2
3
gen_firstname(country = "uk", gender = "male", birthyear = 2013)
gen_firstname(country = "us", gender = "male", race = 2)
gen_firstname(country = "us", gender = "male", race = 'Hispanic')

sdglinkage documentation built on April 27, 2020, 5:09 p.m.