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

Usage

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

Pedestrian-related KSI collisions (2006 - 2023).

Tags: Killed or Seriously Injured; KSI; Pedestrian; Traffic; Collision; Traffic Collision

Examples

# \donttest{
df <- try(morie_datasets_tps_pedestrian_ksi(max_features = 5L))
if (!inherits(df, "try-error")) head(df)
#>   OBJECTID  INDEX_ ACCNUM         DATE TIME      STREET1       STREET2
#> 1        1 3366651 884090 1.136178e+12  705  BATHURST ST   DUNDAS ST W
#> 2        2 3366652 884090 1.136178e+12  705  BATHURST ST   DUNDAS ST W
#> 3        3 3370333 885782 1.136351e+12 1940  DUFFERIN ST    SYLVAN AVE
#> 4        4 3370334 885782 1.136351e+12 1940  DUFFERIN ST    SYLVAN AVE
#> 5        5 3363337 882079 1.136524e+12 2210 DON MILLS RD LEITH HILL RD
#>        OFFSET     ROAD_CLASS              DISTRICT LATITUDE LONGITUDE
#> 1 60 NORTH OF Major Arterial Toronto and East York 43.65289 -79.40625
#> 2 60 NORTH OF Major Arterial Toronto and East York 43.65289 -79.40625
#> 3        <NA> Major Arterial Toronto and East York 43.65514 -79.43359
#> 4        <NA> Major Arterial Toronto and East York 43.65514 -79.43359
#> 5        <NA> Major Arterial            North York 43.77706 -79.34786
#>            ACCLOC       TRAFFCTL VISIBILITY            LIGHT RDSFCOND
#> 1            <NA>     No Control      Other Dark, artificial      Wet
#> 2            <NA>     No Control      Other Dark, artificial      Wet
#> 3 At Intersection Traffic Signal       Rain             Dark      Wet
#> 4 At Intersection Traffic Signal       Rain             Dark      Wet
#> 5 At Intersection Traffic Signal      Clear Dark, artificial      Dry
#>            ACCLASS             IMPACTYPE    INVTYPE   INVAGE INJURY FATAL_NO
#> 1 Non-Fatal Injury Pedestrian Collisions     Driver 30 to 34   None       NA
#> 2 Non-Fatal Injury Pedestrian Collisions Pedestrian 45 to 49  Major       NA
#> 3 Non-Fatal Injury Pedestrian Collisions     Driver 25 to 29   None       NA
#> 4 Non-Fatal Injury Pedestrian Collisions Pedestrian 75 to 79  Major       NA
#> 5 Non-Fatal Injury Pedestrian Collisions     Driver 50 to 54   None       NA
#>   INITDIR                   VEHTYPE      MANOEUVER              DRIVACT
#> 1   South Automobile, Station Wagon Changing Lanes Improper Lane Change
#> 2    West                      <NA>           <NA>                 <NA>
#> 3   South Automobile, Station Wagon    Going Ahead     Driving Properly
#> 4    East                     Other           <NA>                 <NA>
#> 5   South Automobile, Station Wagon    Going Ahead     Driving Properly
#>      DRIVCOND                                                          PEDTYPE
#> 1 Inattentive                                                             <NA>
#> 2        <NA>                                      Pedestrian hit at mid-block
#> 3      Normal                                                             <NA>
#> 4        <NA> Vehicle is going straight thru inter.while ped cross without ROW
#> 5      Normal                                                             <NA>
#>                          PEDACT     PEDCOND CYCLISTYPE CYCACT CYCCOND
#> 1                          <NA>        <NA>         NA     NA      NA
#> 2 Crossing without right of way Inattentive         NA     NA      NA
#> 3                          <NA>        <NA>         NA     NA      NA
#> 4 Crossing without right of way      Normal         NA     NA      NA
#> 5                          <NA>        <NA>         NA     NA      NA
#>   PEDESTRIAN CYCLIST AUTOMOBILE MOTORCYCLE TRUCK TRSN_CITY_VEH EMERG_VEH
#> 1        Yes      NA        Yes         NA    NA            NA        NA
#> 2        Yes      NA        Yes         NA    NA            NA        NA
#> 3        Yes      NA        Yes         NA    NA            NA        NA
#> 4        Yes      NA        Yes         NA    NA            NA        NA
#> 5        Yes      NA        Yes         NA    NA            NA        NA
#>   PASSENGER SPEEDING AG_DRIV REDLIGHT ALCOHOL DISABILITY HOOD_158
#> 1        NA       NA      NA       NA      NA         NA       78
#> 2        NA       NA      NA       NA      NA         NA       78
#> 3        NA       NA      NA       NA      NA         NA       83
#> 4        NA       NA      NA       NA      NA         NA       83
#> 5        NA       NA      NA       NA      NA         NA       47
#>      NEIGHBOURHOOD_158 HOOD_140         NEIGHBOURHOOD_140 DIVISION
#> 1 Kensington-Chinatown       78 Kensington-Chinatown (78)      D14
#> 2 Kensington-Chinatown       78 Kensington-Chinatown (78)      D14
#> 3       Dufferin Grove       83       Dufferin Grove (83)      D11
#> 4       Dufferin Grove       83       Dufferin Grove (83)      D11
#> 5   Don Valley Village       47   Don Valley Village (47)      D33
# }