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 Error #13

Open JPRayes opened 2 years ago

JPRayes commented 2 years ago

Not sure what I'm doing wrong here:

CHUNK:

den.pop1 <-
get_acs( geography = "tract", 
         variables = "B01003_001",
         state = "8", 
         county = county.fips[state.fips=="8"], 
         geometry = TRUE ) %>% 
    select(GEOID, estimate ) %>%
    rename( POP=estimate )

Error:

Error: Your API call has errors. The API message returned is error: invalid 'in' argument.

Appreciate any feedback

dholford commented 2 years ago

You may have already tried this, but I would try re-running the chunk where you run your census key. The error sounds like it's an issue accessing the data.

JPRayes commented 2 years ago

@dholford I did try re-running it and still get the same error. Thanks for the help though.

dholford commented 2 years ago

The only other thing I can think of that wouldn't be on the API end would be making sure there's nothing wrong with where you named state.fips and county.fips. If there's something off in there it would be the root of the issue.

lecy commented 2 years ago

It's helpful if you show your workflow or at least inputs. For example, what does this print?

county.fips[ state.fips == "8" ]

I suspect it is using 8 instead of 08.

state = "8"
# vs
state = "08"

Or similarly, if the state.fips is stored as a character vector then you might be returning an empty list of county FIPS.

county.fips[ state.fips == "8" ]
# vs
county.fips[ state.fips == "08" ]

If it's not working break the steps apart and run them one at a time. It's the best way to really start understanding the code.

JPRayes commented 2 years ago

@lecy Thanks for the help. It was the state identifier. I used "8" instead of "08"

lecy commented 2 years ago

Super annoying convention, but its standard for Census data and Shapefiles so what we are stuck with!