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 25c20a7f15e44579acb947510405ab24.

Usage

morie_datasets_tps_budget_2022(
  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

Toronto Police Service dataset.

Tags: Budget; Toronto Police Service; TPS

Examples

# \donttest{
df <- try(morie_datasets_tps_budget_2022(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   Fiscal_Year     Budget_Type        Organization_Entity
#> 1        2022 Approved Budget 1 - Toronto Police Service
#> 2        2022 Approved Budget 1 - Toronto Police Service
#> 3        2022 Approved Budget 1 - Toronto Police Service
#> 4        2022 Approved Budget 1 - Toronto Police Service
#> 5        2022 Approved Budget 1 - Toronto Police Service
#>                            Command_Name
#> 1 Centralized Service Charges (Command)
#> 2 Centralized Service Charges (Command)
#> 3             Chief of Police (Command)
#> 4 Centralized Service Charges (Command)
#> 5 Centralized Service Charges (Command)
#>                                Pillar_Name                   District_Name
#> 1 Centralized Service Chrgs & UNS (Pillar)     Centralized Service Charges
#> 2                  Reserves Group (Pillar)                  Reserves Group
#> 3 Centralized Command Charges,CHF (Pillar) Centralized Command Charges,CHF
#> 4                  Reserves Group (Pillar)                  Reserves Group
#> 5 Centralized Service Chrgs & UNS (Pillar)     Centralized Service Charges
#>                          Unit_Name Feature_Category Cost_Element
#> 1      Centralized Service Charges         Benefits         1711
#> 2                   Reserves Group         Benefits         1719
#> 3 Centralized Command Charges, CHF         Services         4230
#> 4                   Reserves Group         Benefits         1722
#> 5      Centralized Service Charges         Benefits         1712
#>               Cost_Element_Long_Name   Amount ObjectId
#> 1              Comprehensive Medical 28990100        1
#> 2     Health care benefits - retiree  2683400        2
#> 3   Business travel - other expenses        0        3
#> 4 Long-term Disability - Sr. Officer        0        4
#> 5                        Dental Plan 12646800        5
# }