Skip to contents

person names methods

Details

Note that with the male/female versions if the locale doesn't provide a male/female version then we fall back to the generic thing, e.g., if no female first name we give you first name

Super class

charlatan::BaseProvider -> PersonProvider

Public fields

locale

(character) the locale

formats

(character) person name formats

person

(character) person name data

messy

(logical) the messy setting, TRUE or FALSE

Methods

Inherited methods


Method allowed_locales()

fetch the allowed locales for this provider

Usage

PersonProvider$allowed_locales()


Method new()

Create a new PersonProvider object

Usage

PersonProvider$new(locale = NULL, messy = FALSE)

Arguments

locale

(character) the locale to use. See $allowed_locales() for locales supported (default: en_US)

messy

(logical) make some messy data. Default: FALSE

Returns

A new PersonProvider object


Method render()

Make a person's name

Usage

PersonProvider$render(fmt = NULL)

Arguments

fmt

(character) a name format, default: NULL


Method first_name()

make a first name

Usage

PersonProvider$first_name()


Method first_name_female()

make a female first name

Usage

PersonProvider$first_name_female()


Method first_name_male()

make a male first name

Usage

PersonProvider$first_name_male()


Method last_name()

make a last name

Usage

PersonProvider$last_name()


Method last_name_female()

make a female last name

Usage

PersonProvider$last_name_female()


Method last_name_male()

make a male last name

Usage

PersonProvider$last_name_male()


Method prefix()

make a name prefix

Usage

PersonProvider$prefix()


Method prefix_female()

make a female name prefix

Usage

PersonProvider$prefix_female()


Method prefix_male()

make a male name prefix

Usage

PersonProvider$prefix_male()


Method suffix()

make a name suffix

Usage

PersonProvider$suffix()


Method suffix_female()

make a female name suffix

Usage

PersonProvider$suffix_female()


Method suffix_male()

make a male name suffix

Usage

PersonProvider$suffix_male()


Method clone()

The objects of this class are cloneable with this method.

Usage

PersonProvider$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

x <- PersonProvider$new()
x$locale
#> [1] "en_US"
x$render()
#> [1] "Estill Mohr PhD"
x$first_name()
#> [1] "Emery"
x$first_name_female()
#> [1] "Vida"
x$first_name_male()
#> [1] "Domenic"
x$last_name()
#> [1] "Larkin"
x$last_name_female()
#> [1] "Cassin"
x$last_name_male()
#> [1] "Upton"

x <- PersonProvider$new(locale = "en_GB")
x$locale
#> [1] "en_GB"
x$render()
#> [1] "Ms. Katherine White"
x$first_name()
#> [1] "Kerry"
x$first_name_female()
#> [1] "Elizabeth"
x$first_name_male()
#> [1] "Sam"
x$last_name()
#> [1] "Parry"
x$last_name_female()
#> [1] "Edwards"
x$last_name_male()
#> [1] "Spencer"

z <- PersonProvider$new(locale = "fr_FR")
z$locale
#> [1] "fr_FR"
z$render()
#> [1] "Arthur Etienne"
z$first_name()
#> [1] "Claudine"
z$first_name_female()
#> [1] "Martine"
z$first_name_male()
#> [1] "Guillaume"
z$last_name()
#> [1] "Pérrot"
z$last_name_female()
#> [1] "Rolland"
z$last_name_male()
#> [1] "Blin"
z$prefix()
#> [1] "d'"

z <- PersonProvider$new(locale = "de_AT")
z$locale
#> [1] "de_AT"
z$render()
#> [1] "Franz Cech"
z$first_name()
#> [1] "Johannes"
z$last_name()
#> [1] "Wimmer"
z$prefix()
#> [1] "Univ.Prof."

z <- PersonProvider$new(locale = "cs_CZ")
z$locale
#> [1] "cs_CZ"
z$render()
#> [1] "Jindřich Král DiS."
z$first_name()
#> [1] "Kristina"
z$first_name_female()
#> [1] "Karolína"
z$first_name_male()
#> [1] "Radim"
z$last_name()
#> [1] "Mašek"
z$last_name_female()
#> [1] "Vlčková"
z$last_name_male()
#> [1] "Fiala"
z$prefix()
#> [1] "RNDr."

z <- PersonProvider$new(locale = "es_MX")
z$locale
#> [1] "es_MX"
z$render()
#> [1] "Estefanía Bahena Muñiz"
z$first_name()
#> [1] "Victoria"
z$first_name_female()
#> [1] "Camilo"
z$first_name_male()
#> [1] "Paola"
z$last_name()
#> [1] "Molina"
z$prefix()
#> [1] "Lic."

z <- PersonProvider$new(locale = "en_NZ")
z$locale
#> [1] "en_NZ"
z$render()
#> [1] "Nicole Strawbridge"
z$first_name()
#> [1] "Lisa"
z$first_name_female()
#> [1] "Nikita"
z$first_name_male()
#> [1] "Regan"
z$last_name()
#> [1] "Procter"

PersonProvider$new(locale = "fr_CH")$render()
#> [1] "Odette Babey"
PersonProvider$new(locale = "fi_FI")$render()
#> [1] "Aromaa, Mauri"
PersonProvider$new(locale = "fa_IR")$render()
#> [1] "محیا پارسا"
PersonProvider$new(locale = "es_ES")$render()
#> [1] "Carla Leal Batalla"
PersonProvider$new(locale = "de_DE")$render()
#> [1] "Almuth Trapp"
PersonProvider$new(locale = "de_AT")$render()
#> [1] "Raphael Wimmer"
PersonProvider$new(locale = "cs_CZ")$render()
#> [1] "JUDr. Alžběta Vlčková"
PersonProvider$new(locale = "bg_BG")$render()
#> [1] "Г-н Яник Парашкевов"
PersonProvider$new(locale = "da_DK")$render()
#> [1] "Dr. Nete Christiansen"