race_prr: Wrapper around predictrace::predict_race()

View source: R/main.R

race_prrR Documentation

Wrapper around predictrace::predict_race()

Description

Wrapper around predictrace::predict_race()

Usage

race_prr(.tab, .use = c("first_name", "last_name"))

Arguments

.tab

Input Table (see details)

.use

Which name variables to use?
First Name (first_name) or Last Name (last_name)

Details

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)

Value

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

Examples

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)


MatthiasUckert/Rrace documentation built on Sept. 8, 2023, 3:26 p.m.