Skip to content

Notes on Table Formatting Ideas

Suzanne Childress edited this page Aug 13, 2021 · 3 revisions

Currently the data is fairly long and the formatting is pretty raw. If you run this below, you'll get an output that looks like the following.

county.big.tbl <- psrccensus::get_acs_recs(geography='county',table.names=c('B03002'),years=c(2019), acs.type='acs1') write.table(county.big.tbl, "clipboard", sep="\t", row.names=FALSE)

(result is truncated because the table is big)

"GEOID" "name" "state" "variable" "estimate" "moe" "label" "concept" "census_geography" "acs_type" "year"
"53033" "King County" "Washington" "B03002_001" 2252782 NA "Estimate!!Total:" "HISPANIC OR LATINO ORIGIN BY RACE" "County" "acs1" 2019
"53033" "King County" "Washington" "B03002_002" 2030140 NA "Estimate!!Total:!!Not Hispanic or Latino:" "HISPANIC OR LATINO ORIGIN BY RACE" "County" "acs1" 2019
"53033" "King County" "Washington" "B03002_003" 1302544 3208 "Estimate!!Total:!!Not Hispanic or Latino:!!White alone" "HISPANIC OR LATINO ORIGIN BY RACE" "County" "acs1" 2019
"53033" "King County" "Washington" "B03002_004" 147822 4678 "Estimate!!Total:!!Not Hispanic or Latino:!!Black or African American alone" "HISPANIC OR LATINO ORIGIN BY RACE" "County" "acs1" 2019
"53033" "King County" "Washington" "B03002_005" 13321 1990 "Estimate!!Total:!!Not Hispanic or Latino:!!American Indian and Alaska Native alone" "HISPANIC OR LATINO ORIGIN BY RACE" "County" "acs1" 2019
"53033" "King County" "Washington" "B03002_006" 424590 7085 "Estimate!!Total:!!Not Hispanic or Latino:!!Asian alone" "HISPANIC OR LATINO ORIGIN BY RACE" "County" "acs1" 2019

What I think we should do is make tables that are really similar to our travel survey explorer. The user should be able to select whether they want shares, totals, share with margin of error, or total with margin of error. The function should download the data into xlsx in a similar way to the data explorer, and name the file by the year, the concept, and the geography scale. So one sheet of the data would look like this (taking an example from the data explorer).

Sample county African American African American_MOE Asian Asian_MOE Child Child_MOE Hispanic Hispanic_MOE Missing Missing_MOE Other Other_MOE White Only White Only_MOE Result Type
King 3.9% +/-1.2% 10.7% +/-1.2% 21.7% +/-1.2% 3.9% +/-1.2% 15.9% +/-1.2% 5.7% +/-1.2% 38.2% +/-1.2% Regional results
Kitsap 2% +/-5.7% 2.1% +/-5.7% 21.7% +/-5.7% 2.6% +/-5.7% 2.4% +/-5.7% 4.5% +/-5.7% 64.5% +/-5.7% Regional results
Pierce 8% +/-3.4% 3% +/-3.4% 23.1% +/-3.4% 4.5% +/-3.4% 2.8% +/-3.4% 9% +/-3.4% 49.6% +/-3.4% Regional results
Snohomish 1.2% +/-4% 8.1% +/-4% 23.3% +/-4% 4.9% +/-4% 13.9% +/-4% 4.3% +/-4% 44.3% +/-4% Regional results
Clone this wiki locally