Watts-College / paf-516-template

https://watts-college.github.io/paf-516-template/
0 stars 0 forks source link

Lab02 "API call has errors" #22

Open CTNovoa opened 2 days ago

CTNovoa commented 2 days ago

When I am working with the slide entitled, "Getting Unemployment Figures," I am getting the following error:

"Error: Your API call has errors. The API message returned is error: unknown/unsupported geography hierarchy."

Does anyone know how to resolve this?

census_api_key("c70522515d1eaaaa02bea7cc5b3e1046d654dec3") 

Lab02Variables <- c(House.Value = "B25077_001", Median.Income = "B06011_001")

CenDF <- get_acs(geography = "tract", variables = Lab02Variables,
                 year=2017, survey="acs5", 
                 geometry = TRUE,shift_geo = TRUE)
ykimasu commented 2 days ago

Did you have a chance to ask this to ChatGPT? This is a great chance to learn how to work with Generative AI. I hope that students have a conversation about how to address this using ChatGPT in this thread. Yushim

On Mon, Oct 28, 2024 at 6:22 PM CTNovoa @.***> wrote:

When I am working with the slide entitled, "Getting Unemployment Figures," I am getting the following error:

"Error: Your API call has errors. The API message returned is error: unknown/unsupported geography hierarchy."

Does anyone know how to resolve this?

census_api_key("c70522515d1eaaaa02bea7cc5b3e1046d654dec3")

Lab02Variables <- c(House.Value = "B25077_001", Median.Income = "B06011_001")

CenDF <- get_acs(geography = "tract", variables = Lab02Variables, year=2017, survey="acs5", geometry = TRUE,shift_geo = TRUE)

— Reply to this email directly, view it on GitHub https://github.com/Watts-College/paf-516-template/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/APE4TXGULR56LM3NZCAWHTLZ53PN5AVCNFSM6AAAAABQYVSIN2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYTSOBZGM2DKNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ykimasu commented 2 days ago

A tip can be. You can copy and paste the codes to ChatGPT prompt area and explain what you were trying to do and ask how to resolve it.

CTNovoa commented 2 days ago

Thanks for the suggestion, @ykimasu ! I have given this a try and it seems that the error is most likely coming from the "geography='tract'" section of the code, but I copied that code directly from the lecture videos. Has anyone else run into this issue and if so, how did you resolve it?

I appreciate any help and ideas. Thank you!

ashleywilk commented 1 day ago

Hi @CTNovoa, I am unable to progress forward at the same part of my code. I posted my code below, but am getting an incorrect code for the state name and county, but if we want to look at the country as a whole I thought we would need to leave it blank. Did you figure out where you were getting stuck? values <- c( houseValue = "B25107_001", # Median house value medianHHIncome = "B25099_001" # Median household income )

CenDf <- get_acs( geography = "tract", year = 2017, survey = "acs5", variables = values, state = "",
county = "",
geometry = TRUE )

ashleywilk commented 1 day ago

Following up I asked chatGPT like suggested above, and this was the response given -- hope it helps!

Missing or Incorrect state and county Parameters:

If you're querying census tracts, tidycensus requires a state parameter (and sometimes a county).
For nationwide data at the tract level, leaving the state parameter blank should work, but specifying each state individually can sometimes bypass errors.