Skip to contents

Toronto PS ArcGIS Hub dataset wrapper. Thin dispatch to morie_datasets_tps_arcgis_hub_by_id() with the canonical hub item_id 6cb7e76c7d5b4bf5bce0c533ca7fdf40.

Usage

morie_datasets_tps_gross_expenditures_by_division(
  format = "json",
  where = "1=1",
  max_features = NULL,
  layer_idx = 0L,
  offline = TRUE,
  dest = NULL
)

Arguments

format

One of "json" (default), "geojson", "csv", "shapefile", "fgdb".

where

SoQL-style WHERE filter passed to FeatureServer ?where= (default "1=1").

max_features

Optional cap on returned rows. Passed as resultRecordCount to FeatureServer; ignored for binary formats.

layer_idx

Integer index of the FeatureServer layer to pull (default 0L, the first layer).

offline

Logical; if TRUE, the hub_id is resolved via the included catalog (no network needed for the resolution step). Default TRUE – you can run this against the 71 catalog entries without network. Live data fetches always hit the network regardless of this argument; "offline" here only affects the hub_id -> FeatureServer URL lookup.

dest

Optional path for binary downloads (format %in% c("shapefile", "fgdb")); defaults to tempfile().

Value

A data.frame / GeoJSON list / file path; see morie_datasets_tps_arcgis_hub_by_id() for per-format semantics.

Details

This dataset provides a breakdown of the Gross Expenditures for each division. This data includes the command level at the time of reporting.

Tags: ASR; TPS; Toronto Police; Annual Statistical Report; Budget

Examples

# \donttest{
df <- try(morie_datasets_tps_gross_expenditures_by_division(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   INDEX_ YEAR     CATEGORY    DIVISION COMMAND GROSS_EXPENDITURE__FINAL_
#> 1      1 2014 Expenditures Division 11 Central           $25,008,526.00 
#> 2      2 2014 Expenditures Division 12 Central           $24,858,615.00 
#> 3      3 2014 Expenditures Division 13 Central           $21,740,037.00 
#> 4      4 2014 Expenditures Division 14 Central           $31,984,099.00 
#> 5      5 2014 Expenditures Division 51 Central           $31,724,579.00 
#>   ObjectId
#> 1        1
#> 2        2
#> 3        3
#> 4        4
#> 5        5
# }