Function to generate random gender and ethnicity correct first and/or last names. Names are chosen proportionally based upon their probability of appearing in a large scale data base of real names.
Function to generate random gender and ethnicity correct first and/or/last names. The function probabilistically samples from the embedded randomNamesData dataset to provide a realistic list of
first and/or last names.
OPTIONAL. Integer indicating how many name to produce. Best to use when no gender or ethnicity data is provided and one simple wants n random first and/or
last names.
gender
OPTIONAL. A vector indicating the genders for the names to be calcualted. The maximum of n, the length of gender and the length of
ethnicity is the number of random names returned. Note that the gender vector is only employed for deriving first names.
If no gender vector is provided, the function randomly samples from both genders to produce a sample of names. See examples for various use cases.
ethnicity
OPTIONAL. A vector indicating the ethnicities for the names to be calculated. The maximum of n, the length of gender and the length of
ethnicity is the number of random names returned. Note that the ethnicity vector is employed for both deriving first and last names. If no ethnicity vector
is provided the function samples from all ethnicity to produce a sample of names. See examples for various use cases.
which.names
OPTIONAL. One of "both" (the default), "first", or "last" indicating what names to produce.
name.order
OPTIONAL. If which.names is "both", then names can be returned as either "last.first" (the default) or "first.last".
name.sep
OPTIONAL. If which.names is "both", then names are separated by the name.sep string provided. Defaults to comma-space separated.
Details
Typical use of the function is to submit a vector of genders and ethnicities to derived a gender and ethnicity representative vector of first and/or last names.
Value
Function returns a character vector containing first and/or last names.