Calculates the Population of Cities by County Geography
Calc_Cities_Pop.Rd
This is a helper function for the DSPGrocery::Auto_Rural_Pop function which calculates the total population of cities within a county that intersect county geography. The call first pulls all cities in a provided state and uses an sf::st_join to join based on county instersections.
Arguments
- states_unique
this is a vector of unique state FIPS codes inherited from the df_buffer_loc parameter in DSPGrocery::Auto_Rural_Pop.
- all_counties_pops
this is the returned data frame inherited from the call DSPGrocery::Calc_Counties_Pop.
Value
the function returns a data frame called all_cities_intersect
containing
county, city, city population, and sf geographies. The data frame is returned
with an attribute called "all_population" which is the sum of city populations.
Details
The call uses data pulled from the United States Census Bureau with a call to the tidycensus API, tidycensus::get_decennial.