Mencari data dengan tidycensus

Menganalisis Data Sensus AS di R

Kyle Walker

Instructor

Mencari variabel Sensus

Untuk menemukan ID variabel Sensus, gunakan:

  • Sumber daring seperti Census Reporter
  • Pencarian variabel bawaan di tidycensus
Menganalisis Data Sensus AS di R

Memilih kumpulan data untuk dicari

v16 <- load_variables(year = 2016,
                      dataset = "acs5",
                      cache = TRUE)                    
v16
# A tibble: 22,855 x 3
   name      label                                  concept                     
   <chr>     <chr>                                  <chr>                       
 1 AIANHH    FIPS AIANHH code                       <NA>                        
 2 AIHHTLI   American Indian Trust Land/Hawaiian H~ <NA>                        
 3 AITSCE    American Indian Tribal Subdivision (F~ <NA>                        
 4 ANRC      Alaska Native Regional Corporation (F~ <NA>                        
 5 B00001_0~ Estimate!!Total                        UNWEIGHTED SAMPLE COUNT OF ~
 6 B00002_0~ Estimate!!Total                        UNWEIGHTED SAMPLE HOUSING U~
# ... with 22,84 more rows
Menganalisis Data Sensus AS di R

Menyaring kumpulan variabel

library(tidyverse)
B19001 <- filter(v16, str_detect(name, "B19001"))
B19001
# A tibble: 170 x 3
   name      label                  concept                                     
   <chr>     <chr>                  <chr>                                       
 1 B19001_0~ Estimate!!Total        HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 2 B19001_0~ Estimate!!Total!!Less~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 3 B19001_0~ Estimate!!Total!!$10,~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 4 B19001_0~ Estimate!!Total!!$15,~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 5 B19001_0~ Estimate!!Total!!$20,~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 6 B19001_0~ Estimate!!Total!!$25,~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 7 B19001_0~ Estimate!!Total!!$30,~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
 8 B19001_0~ Estimate!!Total!!$35,~ HOUSEHOLD INCOME IN THE PAST 12 MONTHS (IN ~
# ... with 162 more rows
Menganalisis Data Sensus AS di R

Struktur variabel ACS

Anatomi variabel ACS B19001_002E:

  • B: menunjuk ke tabel base. Prefiks lain: C, DP, S.
  • 19001: ID tabel
  • 002: kode variabel dalam tabel
  • E: menunjuk ke estimate.

    • opsional dalam fungsi tidycensus, yang mengembalikan E dan M untuk setiap variabel.
Menganalisis Data Sensus AS di R

Ayo berlatih!

Menganalisis Data Sensus AS di R

Preparing Video For Download...