View source: R/surname_utils.R
predict_race_multi_barreled | R Documentation |
Predicts, for one row in a voter file, the probability of a voter having a certain race by averaging over each "barrel" of the surname.
predict_race_multi_barreled(
voter_file,
surname_col = "last_name",
surname_only = TRUE,
census_data = NULL,
census_geo = "block",
surname_year = 2010,
use_age = FALSE,
use_sex = FALSE,
state = NULL,
county = NULL,
tract = NULL,
block = NULL,
pattern = "[ -]+",
remove_patterns = NULL
)
voter_file |
The voter file, with each row consisting of a voter. |
surname_col |
A string denoting the surname column. |
surname_only |
Whether to obtain probabilities for surnames only. |
census_data |
A data frame containing Census data corresponding to the geographic information for units in the voter file. |
census_geo |
The census level at which to apply BISG. Passed to WRU. |
surname_year |
Which Census year to use for surname matching. Passed to WRU. |
use_age |
Whether to use the age in the BISG calculation. Passed to WRU. |
use_sex |
Whether to use the sex in the BISG calculation. Passed to WRU. |
state |
A string denoting the state for which the data is queried. |
county |
A string denoting the column containing the county FIPS code. |
tract |
A string denoting the column containing the tract FIPS code. |
block |
A string denoting the column containing the block FIPS code. |
pattern |
What pattern to split surnames on. By default, surnames are split on a space(s), which assumes hyphens have already been removed. |
remove_patterns |
A list of strings which will be removed from the list of barrels. |
A vector of probabilities for each surname.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.