Skip to contents

Predict sex and maybe country from a name.

Usage

predict_demographics(given, family = NULL, country = NULL,
  source = "all", dir = tempdir(), ssa_source = "national",
  full_country = FALSE, verbose = TRUE)

Arguments

given

A vector of given (first) names. Case sensitive for all but wgnd.

family

A vector of family (last; sur) names. Only used in fb to adjust country predictions. Case sensitive.

country

A vector of 2-letter country codes. Only used in wgnd to give sex_in_country_wgnd.

source

A vector specify which source(s) to use:

Defaults to all to return all.

dir

Directory in which to save original and prepared names data.

ssa_source

Source of USSSA data; passed to get_baby_names.

full_country

Logical; if TRUE, a column for each country will be returned for source fb, each containing a probability for that country. Otherwise, only the most likely country is returned in a predicted_country column.

verbose

Logical; if FALSE, will not show status messages.

Value

A data.frame with columns for given, family, and country (as provided), and columns for each source, including count and prob_fem prefixed by the source code, and for fb, either predicted_country_fb, or a set of country codes prefixed by _fb.

Examples

if (FALSE) { # \dontrun{

# saves to a temporary directory
predict_demographics(c("Jane", "John"), c("Doe", "Doe"))
} # }