race_prr | R Documentation |
Wrapper around predictrace::predict_race()
race_prr(.tab, .use = c("first_name", "last_name"))
.tab |
Input Table (see details) |
.use |
Which name variables to use? |
The column 'method' encodes several variables at one and is encoded in the following way:
package-first name used-last name used-geo loaction used-age used-gender used-geo location
For example: The method WRU-0-1-1-1-1-C means that the package WRU is used, prediction is not based on the first name,
predictio is based on the last name, geo location is used, age is used, gender is used, and the geo location is a COunty (C)
The original data frame (.tab in long format) appended with the following columns:
method: Used methods (see details for more information)
pasian: Probability of the person being asian
pblack: Probability of the person being black
phispa: Probability of the person being hispanic
pwhite: Probability of the person being white
pother: Probability of the person being non of the above races
race: The most likely race as predicted by the respective method
library(rRace)
tab_names <- name_table
race_prr(tab_names) # Using First/Last Name
race_prr(tab_names, "first_name") # Using First Name
race_prr(tab_names, "last_name") # Using Last Name
# Using Middle Name (Throws an error, because there's no prediction on middle names)
# If a middle name is present in your dataset, consider pasting it together with the first name
## Not run:
race_prr(tab_names, "middle_name")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.