predictrace v1.0.0

0

Monthly downloads

0th

Percentile

Predict the Race of a Given Surname Using Census Data

Predicts the most common race of a surname based on U.S. Census data.

Readme

CRAN\_Status\_Badge AppVeyor Build
Status Build
Status Coverage
status

Overview

The goal of race is to predict the race of a surname. This package uses U.S. Census data which says how many people of each race has a certain surname. From this we can predict which race is mostly likely to have that surname. The possible races are American Indian, Asian, Black, Hispanic, White, or two or more races.

Installation

To install this package, use the code
install.packages("predictrace")


# Th e development version is available on Github.
# install.packages("devtools")
devtools::install_github("jacobkap/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.

library(predictrace)
predict_race("Washington")
##         name match_name likely_race probability_american_indian
## 1 Washington washington       black                      0.0068
##   probability_asian probability_black probability_hispanic
## 1             0.003            0.8753               0.0254
##   probability_white probability_2races
## 1            0.0517             0.0378

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.0068
## 2   Franklin   franklin       white                      0.0083
## 3    Lincoln    lincoln       white                      0.0368
##   probability_asian probability_black probability_hispanic
## 1            0.0030            0.8753               0.0254
## 2            0.0054            0.3876               0.0270
## 3            0.0135            0.1471               0.0251
##   probability_white probability_2races
## 1            0.0517             0.0378
## 2            0.5438             0.0278
## 3            0.7490             0.0285

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

Functions in predictrace

Name Description
predict_race Find the race of a surname
surnames_race Surnames and number of people of each race with that surname.
No Results!

Vignettes of predictrace

Name
Predict-race-of-surname.Rmd
No Results!

Last month downloads

Details

License MIT + file LICENSE
Encoding UTF-8
LazyData true
VignetteBuilder knitr
RoxygenNote 6.1.1
Language en-US
NeedsCompilation no
Packaged 2019-05-10 16:42:36 UTC; user
Repository CRAN
Date/Publication 2019-05-22 07:50:03 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/predictrace)](http://www.rdocumentation.org/packages/predictrace)