Skip to contents

TPS PSDP – Assault

Usage

morie_datasets_tps_assault(
  year = NULL,
  max_features = NULL,
  offline = TRUE,
  layer_url = NULL
)

Arguments

year

Optional reporting year filter (applies an OCC_YEAR = <year> WHERE clause when offline = FALSE).

max_features

Optional cap on returned rows (offline = FALSE only).

offline

If TRUE (default), read the included synthetic fixture from inst/extdata/tps_mha_apprehensions_sample.csv (5 rows in the canonical TPS PSDP 22-column schema). If FALSE, hit the TPS PSDP ArcGIS FeatureServer.

layer_url

Optional ArcGIS layer URL override.

Value

A data.frame.

Examples

df <- morie_datasets_tps_assault(offline = TRUE)
head(df)
#>   OBJECTID           EVENT_UNIQUE_ID         REPORT_DATE            OCC_DATE
#> 1        1 GO-PSDP-SYNTH-ASSAULT-001 2024/01/02 00:00:00 2024/01/01 00:00:00
#> 2        2 GO-PSDP-SYNTH-ASSAULT-002 2024/03/10 12:00:00 2024/03/10 11:30:00
#> 3        3 GO-PSDP-SYNTH-ASSAULT-003 2024/06/15 22:00:00 2024/06/15 21:45:00
#> 4        4 GO-PSDP-SYNTH-ASSAULT-004 2024/09/20 03:00:00 2024/09/20 02:15:00
#> 5        5 GO-PSDP-SYNTH-ASSAULT-005 2025/01/05 09:00:00 2025/01/05 08:30:00
#>   REPORT_YEAR REPORT_MONTH REPORT_DAY REPORT_DOY REPORT_DOW REPORT_HOUR
#> 1        2024            1          2          2    Tuesday           3
#> 2        2024            3         10         70     Sunday          12
#> 3        2024            6         15        167   Saturday          22
#> 4        2024            9         20        264     Friday           3
#> 5        2025            1          5          5     Sunday           9
#>   OCC_YEAR OCC_MONTH OCC_DAY OCC_DOY  OCC_DOW OCC_HOUR DIVISION LOCATION_TYPE
#> 1     2024         1       1       1   Monday       22      D14     Apartment
#> 2     2024         3      10      70   Sunday       11      D52    Commercial
#> 3     2024         6      15     167 Saturday       21      D31       Outdoor
#> 4     2024         9      20     264   Friday        2      D55       Outdoor
#> 5     2025         1       5       5   Sunday        8      D14         House
#>         PREMISES_TYPE UCR_CODE UCR_EXT             OFFENCE CSI_CATEGORY
#> 1           Apartment     1430     200             Assault      Assault
#> 2 Commercial (Office)     1430     210 Assault With Weapon      Assault
#> 3             Outside     1420     100  Aggravated Assault      Assault
#> 4           Apartment     1430     200             Assault      Assault
#> 5               House     1430     200             Assault      Assault
#>   HOOD_158         NEIGHBOURHOOD_158 HOOD_140          NEIGHBOURHOOD_140
#> 1       82                   Niagara       82               Niagara (82)
#> 2      168       Downtown Yonge East       75 Church-Yonge Corridor (75)
#> 3       73                 Moss Park       73             Moss Park (73)
#> 4      163 Fort York-Liberty Village       82               Niagara (82)
#> 5        1    West Humber-Clairville        1 West Humber-Clairville (1)
#>   LONG_WGS84 LAT_WGS84        x       y
#> 1   -79.4029   43.6478 -79.4029 43.6478
#> 2   -79.3793   43.6532 -79.3793 43.6532
#> 3   -79.3705   43.6555 -79.3705 43.6555
#> 4   -79.3832   43.6426 -79.3832 43.6426
#> 5   -79.5800   43.7400 -79.5800 43.7400