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 1cd5d478ef79424a8a6d5319a44edb0a.

Usage

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

The data provided count describes situations involving regulated interactions.

Tags: ASR; TPS; Toronto Police; Annual Statistical Report; Regulated Interactions

Examples

# \donttest{
df <- try(morie_datasets_tps_regulated_interactions(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   INDEX_ YEAR
#> 1      1 2020
#> 2      2 2020
#> 3      3 2020
#> 4      4 2020
#> 5      5 2020
#>                                                                                                                                                                                                   CATEGORY
#> 1                                                                                                                                                                          Number of attempted collections
#> 2                                                                                                                                      Number of attempted collections - Identifying information collected
#> 3                                                                                                                                    Number of individuals from whom identifying information was collected
#> 4 Number of times the individual was not informed he/she was not required to provide identifying information to the officer, because informing the individual:might compromise the safety of an individual
#> 5                                 Number of times the individual was not informed of the reason for the attempted collection because informing the individual:might compromise the safety of an individual
#>   COUNT_ ObjectId
#> 1      4        1
#> 2      3        2
#> 3      3        3
#> 4      1        4
#> 5      0        5
# }