race_wru: Wrapper around wru::predict_race()

View source: R/main.R

race_wruR Documentation

Wrapper around wru::predict_race()

Description

Wrapper around wru::predict_race()

Usage

race_wru(
  .tab,
  .use_geo = FALSE,
  .use_age = FALSE,
  .use_gen = FALSE,
  .census_dir = NULL,
  .census_geo = ""
)

Arguments

.tab

Input Table, must contain at least 2 columns:
id: Unique Identifier of the Data
first_name/last_name: At least a first name OR last name column (both columns are possible)

.use_geo

Should race be inferred from geo location (Logical: TRUE/FALSE, Default: FALSE)?
If TRUE, .tab must contain a column "state" (2 Letter State Codes) and one column of "county", "tract", "block", or "place". See: XXX for more information

.use_age

Should race be inferred from information about a persons birth year (Logical: TRUE/FALSE, Default: FALSE)?
If TRUE .tab must contain a column "age" (age of the person in years)

.use_gen

Should race be inferred from information about a persons gender (Logical: TRUE/FALSE, Default: FALSE)?
If TRUE .tab must contain a column "gen" (coding: male/female)

.census_dir

Directory to save Census Data (can be reused)

.census_geo

Either "county", "tract", "block", or "place"

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


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