Skip to contents

TPS PSDP – Auto Theft

Usage

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

# \donttest{
df <- try(morie_datasets_tps_autotheft(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   OBJECTID      EVENT_UNIQUE_ID         REPORT_DATE            OCC_DATE
#> 1        1 GO-PSDP-SYNTH-AT-001 2024/01/02 00:00:00 2024/01/01 22:00:00
#> 2        2 GO-PSDP-SYNTH-AT-002 2024/05/22 08:00:00 2024/05/22 03:00:00
#> 3        3 GO-PSDP-SYNTH-AT-003 2024/09/15 12:00:00 2024/09/15 06:00:00
#> 4        4 GO-PSDP-SYNTH-AT-004 2025/02/14 14:00:00 2025/02/14 02:00:00
#> 5        5 GO-PSDP-SYNTH-AT-005 2025/03/01 16:00:00 2025/02/28 23:00:00
#>   REPORT_YEAR REPORT_MONTH REPORT_DAY REPORT_DOY REPORT_DOW REPORT_HOUR
#> 1        2024            1          2          2    Tuesday           3
#> 2        2024            5         22        143  Wednesday           8
#> 3        2024            9         15        259     Sunday          12
#> 4        2025            2         14         45     Friday          14
#> 5        2025            3          1         60   Saturday          16
#>   OCC_YEAR OCC_MONTH OCC_DAY OCC_DOY   OCC_DOW OCC_HOUR DIVISION LOCATION_TYPE
#> 1     2024         1       1       1    Monday       22      D14       Streets
#> 2     2024         5      22     143 Wednesday        3      D52     Apartment
#> 3     2024         9      15     259    Sunday        6      D55         House
#> 4     2025         2      14      45    Friday        2      D31  Parking Lots
#> 5     2025         2      28      59    Friday       23      D14     Apartment
#>   PREMISES_TYPE UCR_CODE UCR_EXT    OFFENCE CSI_CATEGORY HOOD_158
#> 1         Other     2125     100 Auto Theft   Auto Theft       82
#> 2     Apartment     2125     100 Auto Theft   Auto Theft      168
#> 3         House     2125     100 Auto Theft   Auto Theft        1
#> 4       Outside     2125     100 Auto Theft   Auto Theft       73
#> 5     Apartment     2125     100 Auto Theft   Auto Theft      163
#>           NEIGHBOURHOOD_158 HOOD_140          NEIGHBOURHOOD_140 LONG_WGS84
#> 1                   Niagara       82               Niagara (82)   -79.4029
#> 2       Downtown Yonge East       75 Church-Yonge Corridor (75)   -79.3793
#> 3    West Humber-Clairville        1 West Humber-Clairville (1)   -79.5800
#> 4                 Moss Park       73             Moss Park (73)   -79.3705
#> 5 Fort York-Liberty Village       82               Niagara (82)   -79.3832
#>   LAT_WGS84        x       y
#> 1   43.6478 -79.4029 43.6478
#> 2   43.6532 -79.3793 43.6532
#> 3   43.7400 -79.5800 43.7400
#> 4   43.6555 -79.3705 43.6555
#> 5   43.6426 -79.3832 43.6426
# }