compute_p_r_cond_s | R Documentation |
This is a utility function for performing BISG. It operates on a voter file, and utilizes WRU's function for calculating probability of race by surname.
compute_p_r_cond_s(
voter_file,
surname_col,
surname_counts = NULL,
surname_col_counts = "surname",
race_cols = c("whi", "bla", "his", "asi", "oth"),
impute_missing = TRUE
)
voter_file |
A tibble containing a list of voters (by row), and a column that denotes their surname. |
surname_col |
A string denoting which column contains the voter surname. |
surname_counts |
A dataframe denoting the frequency with which surnames correspond to different race/ethnicities. If NULL, the Census surname list is used with categories and merging functions from wru. The dataframe should contain one column with surnames (specified with the y surname_col_counts parameter) and one column for each race/ethnicity group (specified with the race_cols parameter). |
surname_col_counts |
A string denoting the column in the surname_counts tibble that refers to the geographic unit. |
race_cols |
name of race columns in |
impute_missing |
Boolean indicating weather to fill in missing names with mean probability across all surnames. |
A tibble with rows denoting voters and columns denoting the probability that each voter is of a particular racial group.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.