# Predict the race of a surname

#### Jacob Kaplan

#### 2020-09-16

    library(predictrace)

## Usage

The only required parameter is `name` which is the surname you want to find the race of. Please note that this parameter only accepts surnames, including both first and last name will result in not finding a match in the Census data.

    predict_race("Washington")
    #>         name match_name likely_race probability_american_indian
    #> 1 Washington washington       black                      0.0066
    #>   probability_asian probability_black probability_hispanic probability_white
    #> 1            0.0028            0.8865               0.0202            0.0517
    #>   probability_2races
    #> 1             0.0323

This function accepts a single string or a vector of strings.

    predict_race(c("Washington", "Franklin", "Lincoln"))
    #>         name match_name likely_race probability_american_indian
    #> 1 Washington washington       black                      0.0066
    #> 2   Franklin   franklin       white                      0.0085
    #> 3    Lincoln    lincoln       white                      0.0373
    #>   probability_asian probability_black probability_hispanic probability_white
    #> 1            0.0028            0.8865               0.0202            0.0517
    #> 2            0.0050            0.3828               0.0222            0.5577
    #> 3            0.0125            0.1421               0.0215            0.7615
    #>   probability_2races
    #> 1             0.0323
    #> 2             0.0238
    #> 3             0.0250

If you only want the most likely race and not the individual probabilities of each race, set the parameter `probability` to FALSE.

    predict_race("Washington", probability = FALSE)
    #>         name match_name likely_race
    #> 1 Washington washington       black