Watts-College / cpp-529-spr-2022

https://watts-college.github.io/cpp-529-spr-2022/
0 stars 2 forks source link

Lab 04 Step 2 #10

Closed asukajames closed 2 years ago

asukajames commented 2 years ago

Hello! I am confused with Step 2, Census API calls part. I have selected Washington DC for this project and as I searched the city in NBER, it came back as "WASHINGTON, DC-MD-VA-WV"

In the lab instruction, Minneapolis - St. Paul, MN-WI, it spans two states. In my case, it spans four states (DC-MD-VA_WV)? Is DC counted as a state?

However, as I run this chunk, I only see three state fips:

state.fips <- substr( these.fips, 1, 2 )
county.fips <- substr( these.fips, 3, 5 )

cbind( these.fips, state.fips, county.fips ) %>% pander()

state fips

If it spans three states, I need three Census API Calls, correct?

msp.pop1 <-
get_acs( geography = "tract", variables = "B01003_001",
         state = "11", county = county.fips[state.fips=="11"], geometry = TRUE ) %>% 
         select( GEOID, estimate ) %>%
         rename( POP=estimate ) 
ramacdo1 commented 2 years ago

Hi! I think you are misreading, you have four state fips codes: 11, 24, 51, and 54! DC fips state code is 11!

JasonSills commented 2 years ago

Hi, @asukajames, yes try running it with your logic (four times) and see what happens! Repeat the steps for MSP in the tutorial, but across the four fips codes and see what it returns! Working in data science is all about experimentation.

asukajames commented 2 years ago

Thank you @JasonSills and @ramacdo1 :-) !!