predict_ethnicity {rethnicity} | R Documentation |
Predict ethnicity from names.
Description
Predict ethnicity either by last names or both first and last names. This is the default and recommended method for prediction.
Usage
predict_ethnicity(
firstnames = NULL,
lastnames = NULL,
method = "fullname",
threads = 0,
na.rm = FALSE
)
Arguments
firstnames |
A character vector of first names. Default to NULL. Only use this if you are using 'method' = 'fullname'. |
lastnames |
A character vector of last names. Default to NULL. Use this in both 'fullname' and 'lastname' methods. |
method |
"fullname" or "lastname". Inference method to choose from. |
threads |
single integer. Number of threads to use for multi-threading. |
na.rm |
TRUE or FALSE (bool). If TRUE, then the NAs will be removed; if FALSE, then return error if there is NA in the arguments. |
Value
data.frame with probability of being each ethnic group and the predicted group (one with highest probability)
Examples
predict_ethnicity(firstnames = "Alan", lastnames = "Turing")
[Package rethnicity version 0.2.5 Index]