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 a89d10d5e28444ceb0c8d1d4c0ee39cc.

Usage

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

Bicycle Theft occurrences by reported date.

Tags: Bike; Bicycle; Thefts; Crime; Toronto; TPS; Toronto Police

Examples

# \donttest{
df <- try(morie_datasets_tps_bicycle_thefts(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   OBJECTID EVENT_UNIQUE_ID     OCC_DATE OCC_YEAR OCC_MONTH   OCC_DOW OCC_DAY
#> 1        1  GO-20141261431 1.388552e+12     2014   January Wednesday       1
#> 2        2  GO-20141263784 1.388552e+12     2014   January Wednesday       1
#> 3        3  GO-20141263544 1.388034e+12     2013  December  Thursday      26
#> 4        4  GO-20149000090 1.388552e+12     2014   January Wednesday       1
#> 5        5  GO-20141266048 1.388380e+12     2013  December    Monday      30
#>   OCC_DOY OCC_HOUR  REPORT_DATE REPORT_YEAR REPORT_MONTH REPORT_DOW REPORT_DAY
#> 1       1        7 1.388552e+12        2014      January  Wednesday          1
#> 2       1       18 1.388552e+12        2014      January  Wednesday          1
#> 3     360       19 1.388552e+12        2014      January  Wednesday          1
#> 4       1       12 1.388639e+12        2014      January   Thursday          2
#> 5     364       17 1.388639e+12        2014      January   Thursday          2
#>   REPORT_DOY REPORT_HOUR DIVISION
#> 1          1           7      D14
#> 2          1          18      D14
#> 3          1          17      D14
#> 4          2          20      D52
#> 5          2           8      D53
#>                                                            LOCATION_TYPE
#> 1                                       Apartment (Rooming House, Condo)
#> 2                    Single Home, House (Attach Garage, Cottage, Mobile)
#> 3 Other Commercial / Corporate Places (For Profit, Warehouse, Corp. Bldg
#> 4                                       Apartment (Rooming House, Condo)
#> 5                  Streets, Roads, Highways (Bicycle Path, Private Road)
#>   PREMISES_TYPE  BIKE_MAKE  BIKE_MODEL BIKE_TYPE BIKE_SPEED BIKE_COLOUR
#> 1     Apartment SUPERCYCLE        <NA>        MT         10        <NA>
#> 2         House       TREK      SOHO S        RG          1         BLK
#> 3    Commercial       FELT         F59        RC         21      SILRED
#> 4     Apartment         GI TCX2 (2010)        OT          9         BLU
#> 5       Outside        KHS   VITAMIN A        OT         24         WHI
#>   BIKE_COST    STATUS  PRIMARY_OFFENCE HOOD_158            NEIGHBOURHOOD_158
#> 1        NA    STOLEN      THEFT UNDER      085          South Parkdale (85)
#> 2        NA RECOVERED PROPERTY - FOUND      080 Palmerston-Little Italy (80)
#> 3      1300    STOLEN              B&E      165 Harbourfront-CityPlace (165)
#> 4      1019    STOLEN      THEFT UNDER      165 Harbourfront-CityPlace (165)
#> 5       500    STOLEN      THEFT UNDER      039    Bedford Park-Nortown (39)
#>   HOOD_140                      NEIGHBOURHOOD_140 LONG_WGS84 LAT_WGS84
#> 1      085                    South Parkdale (85)  -79.44365  43.63766
#> 2      080           Palmerston-Little Italy (80)  -79.41465  43.66052
#> 3      077 Waterfront Communities-The Island (77)  -79.39564  43.64002
#> 4      077 Waterfront Communities-The Island (77)  -79.39376  43.64277
#> 5      039              Bedford Park-Nortown (39)  -79.42957  43.71842
# }