library(tidyverse)
library(tidycensus)
library(censusr)
tx <- read_rds("data-out/01_tx.rds")
The append_geoid() request wants only certain things named certain ways.
tx_addr <- tx %>%
mutate(state = "TX") %>%
rename(
street = address
) %>%
select(street, city, state)
Removing blank cities in case that is a thing
tx_addr <- tx_addr %>%
filter(!is.na(city))
api_key = Sys.getenv("CENSUS_API_KEY")
# tx_geo <- append_geoid(tx_addr, 'tr')
The append_geoid() request above gives the following traceback error:
Error in call_geolocator(as.character(address$street[i]), as.character(address$city[i]), : Bad Request (HTTP 400).
4. stop(http_condition(x, "error", task = task, call = call))
3. httr::stop_for_status(r)
2. call_geolocator(as.character(address$street[i]), as.character(address$city[i]), as.character(address$state[i]))
1. append_geoid(tx_addr, "tr")
Wondering if the api_key is the problem. Not sure.