get_population_within: Get Population Within Boundary

Description Usage Arguments Value Examples

View source: R/get_population_within.R

Description

Fetches the population within a given boundary. The boundary is given as an sf file and intersected with LSOAs. The population data is fetched from NOMIS population estimates for small areas.

Usage

1
2
3
4
5
6
get_population_within(
  boundary,
  year = "latest",
  age = "all",
  api_key = Sys.getenv("nomis_api_key")
)

Arguments

boundary

an sf polygon in England or Wales.

year

the year for which to return employment data

age

'all' for no age breakdown. 'working' returns young, working age, and older groupings. 'five_year' for five year groupings or 'sya' for single year of age.

api_key

can be specified manually here, or set using 'set_nomis_api' function.

Value

a tibble containing employment data

Examples

1
2
3
4
5
iso <- make_isochrone(site = 'SE1 9SG', time = 30, method = 'mapbox', mode = 'driving')
pop <- get_population_within(iso, 'latest', age = 'all')
# total employment within isochrone:
pop %>%
 dplyr::summarise(total_pop = sum(population_within))

Chrisjb/RDistanceMatrix documentation built on Jan. 27, 2021, 9:12 p.m.