compute_ons_values: Compute standard ONS statistics from a shapefile of points

View source: R/population_weighting.R

compute_ons_valuesR Documentation

Compute standard ONS statistics from a shapefile of points

Description

This function takes a shapefile of points that can represent any services– for example, physicians, WIFI stations, or schools– and some standard ONS data inputs, and calculates five common ONS statistics:

Usage

compute_ons_values(
  point_shapefile,
  name_prefix = "",
  name_postfix = "",
  ons_shp = NA,
  ons_data,
  path_to_od_table,
  verbose = TRUE
)

Arguments

point_shapefile

A shapefile of points representing service locations.

name_prefix

Optional - a prefix to be applied to column names.

name_postfix

Optional - a postfix (?) to be applied to column names.

ons_shp

Optional. An ONS shapefile. If not specified, uses internal data onsr::ons_shp.

ons_data

ONS data. Can be acquired using onsr::get_ons_data().

path_to_od_table

File path to an OD table.

verbose

Boolean, defaults TRUE. Would you like many updates?

Details

  • Points per Neighbourhood

  • Points / 1000 residents in the neighbourhood plus a 50m buffer

  • Average travel distance to 3 nearest points

  • Average travel distance to 1 nearest point

  • % of residents within a 15-minute walk of any point

It needs as input a path to a long origin-destination (OD) table such as can be generated using the Valhalla routing enging and valhallr::od_table().

Value

A tbl_df with the calculated statistics.

Examples

## Not run: 
# file `wifi_walk_table.csv` computed previously using `valhallr::od_table()`
ons_data <- onsr::get_ons_data()
wifi_data <- onsr::compute_ons_values(point_shapefile = wifi_locations_nad, name_postfix = "wifi", ons_data = ons_data,
                                      path_to_od_table =  "outputs/wifi_walk_table.csv")

## End(Not run)

Ottawa-Neighbourhood-Study/onsr documentation built on June 19, 2022, 11:46 a.m.