These value-value tables are useful for recoding the values of from one dataset (CCES) so that they can be merged immediately with another (ACS). These get used internally in ccc_std_demographics, but they are available as built in datasets.
race_key
gender_key
educ_key
educ3_key
ed_ed3_cces
age5_key
age10_key
states_key
All keys are tibbles with one row per recoding value.
race_key
An labelled integer of class haven::labelled. Most compact form of both sources and the values both will get recoded to in MRP.
Labelled versions of the CCES race codings. These are of the same class as the CCES cumulative file.
Labels for the first column, in characters
Corresponding character in the ACS data via the tidycensus package
A numeric value underlying the race
label.
gender_key
:An labelled integer of class haven::labelled. Target variable
Character to recode from. CCES and ACS use the same values.
educ_key
For mapping ACS data values for four-way education e.g. in get_acs_cces:
Character to recode from, in CCES
Character to recode from, in ACS.
An labelled integer of class haven::labelled. Target variable
educ3_key
For mapping ACS data values for three-way education e.g. in get_acs_cces:
Character to recode from, in CCES
Character to recode from, in ACS.
An labelled integer of class haven::labelled. Target variable
age5_key
Age bins, 5-ways, used in acscodes_age_sex_educ. Use ccc_bin_age to recode CCES variable
An labelled integer of class haven::labelled. Target variable.
Character to recode from, in ACS
age10_key
: Age bins, 10-ways, used in acscodes_age_sex_race:An labelled integer of class haven::haven_labelled
. Target variable.
Character to recode from, in ACS
states_key
: State codes and regions:State two-letter abbreviation state.abb
State full name via state.name
State traditional abbreviation following AP style
Integer, state FIPS code
Census region (Northeast, Midwest, South, West)
Census division (New England, Middle Atlantic, South Atlantic, East South Central, West South Central, East North Central, "West North Central, Mountain, Pacific)
These tibbles themselves are not key-values pair in a strict sense because
the dataframe tries to have two recodes CCES to common and ACS to common and so for
a given recode, rows are not distinct. To avoid duplicating rows inadvertently,
use the dplyr::distinct
to reduce the key to two columns with unique rows.
library(ccesMRPprep)
race_key
#> # A tibble: 9 × 5
#> race_num race_cces_chr race_acs race_cces race
#> <int> <chr> <chr> <int+lbl> <int+l>
#> 1 1 White WHITE ALONE, NOT HISPANIC OR LATINO 1 [Whit… 1 [Whi…
#> 2 2 Black BLACK OR AFRICAN AMERICAN ALONE 2 [Blac… 2 [Bla…
#> 3 3 Hispanic HISPANIC OR LATINO 3 [Hisp… 3 [His…
#> 4 4 Asian ASIAN ALONE 4 [Asia… 4 [Asi…
#> 5 4 Asian NATIVE HAWAIIAN AND OTHER PACIFIC … 4 [Asia… 4 [Asi…
#> 6 5 Native American AMERICAN INDIAN AND ALASKA NATIVE … 5 [Nati… 5 [Nat…
#> 7 6 Mixed TWO OR MORE RACES NA 6 [All…
#> 8 6 Other SOME OTHER RACE ALONE NA 6 [All…
#> 9 6 Middle Eastern NA NA 6 [All…
educ_key
#> # A tibble: 26 × 4
#> educ_chr educ_cces_chr doc_note educ
#> <chr> <chr> <chr> <dbl+lbl>
#> 1 Nursery to 4th grade No HS NA 1 [HS or Less]
#> 2 No schooling completed No HS NA 1 [HS or Less]
#> 3 Less than 9th grade No HS NA 1 [HS or Less]
#> 4 Less than high school graduate No HS NA 1 [HS or Less]
#> 5 Less than high school diploma No HS NA 1 [HS or Less]
#> 6 5th and 6th grade No HS NA 1 [HS or Less]
#> 7 7th and 8th grade No HS NA 1 [HS or Less]
#> 8 9th grade No HS NA 1 [HS or Less]
#> 9 10th grade No HS NA 1 [HS or Less]
#> 10 11th grade No HS NA 1 [HS or Less]
#> # ℹ 16 more rows
educ3_key
#> # A tibble: 6 × 3
#> educ_chr educ_cces_chr educ_3
#> <chr> <chr> <dbl+lbl>
#> 1 Less than high school graduate HS or Less 1 [HS or Less]
#> 2 Less than high school diploma HS or Less 1 [HS or Less]
#> 3 High school graduate (includes equivalency) HS or Less 1 [HS or Less]
#> 4 Some college Some College 2 [Some Colle…
#> 5 Some college or associate's degree Some College 2 [Some Colle…
#> 6 Bachelor's degree or higher 4-Year or Post-Grad 3 [4-Year or …
gender_key
#> # A tibble: 2 × 2
#> gender_chr gender
#> <chr> <int+lbl>
#> 1 Male 1 [Male]
#> 2 Female 2 [Female]
age5_key
#> # A tibble: 5 × 2
#> age_chr age
#> <chr> <int+lbl>
#> 1 18 to 24 years 1 [18 to 24 years]
#> 2 25 to 34 years 2 [25 to 34 years]
#> 3 35 to 44 years 3 [35 to 44 years]
#> 4 45 to 64 years 4 [45 to 64 years]
#> 5 65 years and over 5 [65 years and over]
age10_key
#> # A tibble: 10 × 3
#> age_chr age_num age
#> <chr> <int> <int+lbl>
#> 1 18 and 19 years 1 1 [18 to 24 years]
#> 2 20 to 24 years 1 1 [18 to 24 years]
#> 3 25 to 29 years 2 2 [25 to 34 years]
#> 4 30 to 34 years 2 2 [25 to 34 years]
#> 5 35 to 44 years 3 3 [35 to 44 years]
#> 6 45 to 54 years 4 4 [45 to 64 years]
#> 7 55 to 64 years 4 4 [45 to 64 years]
#> 8 65 to 74 years 5 5 [65 years and over]
#> 9 75 to 84 years 5 5 [65 years and over]
#> 10 85 years and over 5 5 [65 years and over]
states_key
#> # A tibble: 50 × 6
#> st state st_trad st_fips region division
#> <chr> <chr> <chr> <int> <fct> <fct>
#> 1 AL Alabama Ala. 1 South East South Central
#> 2 AK Alaska Alaska 2 West Pacific
#> 3 AZ Arizona Ariz. 4 West Mountain
#> 4 AR Arkansas Ark. 5 South West South Central
#> 5 CA California Calif. 6 West Pacific
#> 6 CO Colorado Colo. 8 West Mountain
#> 7 CT Connecticut Conn. 9 Northeast New England
#> 8 DE Delaware Del. 10 South South Atlantic
#> 9 FL Florida Fla. 12 South South Atlantic
#> 10 GA Georgia Ga. 13 South South Atlantic
#> # ℹ 40 more rows