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 4702e79fd2404f7d93dd9866f45d7ec2.

Usage

morie_datasets_tps_arrested_and_charged_persons(
  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 an aggregate count of persons who have been arrested and charged. The data is aggregated by division, neighbourhood, sex, age, crime category, and crime subtype.

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

Examples

# \donttest{
df <- try(morie_datasets_tps_arrested_and_charged_persons(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   INDEX_ ARREST_YEAR DIVISION HOOD_158    NEIGHBOURHOOD_158    SEX AGE_COHORT
#> 1    101        2014      D11      084 Little Portugal (84) Female   45 to 54
#> 2    102        2014      D11      084 Little Portugal (84) Female   45 to 54
#> 3    103        2014      D11      084 Little Portugal (84)   Male        <18
#> 4    104        2014      D11      084 Little Portugal (84)   Male        <18
#> 5    105        2014      D11      084 Little Portugal (84)   Male   18 to 24
#>   AGE_GROUP                  CATEGORY           SUBTYPE ARREST_COUNT ObjectId
#> 1     Adult   Crimes Against Property Theft Under $5000            1        1
#> 2     Adult             Total Arrests     Total Arrests            1        2
#> 3     Youth             Total Arrests     Total Arrests            1        3
#> 4     Youth Crimes Against the Person           Robbery            1        4
#> 5     Adult   Crimes Against Property Theft Under $5000            1        5
# }