
Fetch a TPS category and return it as a data.frame.
Source: R/tps_fetch.R
morie_tps_fetch_dataframe.RdThin wrapper over morie_tps_fetch_category(): writes the CSV
then reads it back. Mirrors the Python fetch_tps_dataframe
convenience used as a DATASET_CATALOG fetcher.
Arguments
- category
One of
morie_tps_list_categories().- ...
Passed through to
morie_tps_fetch_category().
Examples
# \donttest{
df <- try(morie_tps_fetch_dataframe(morie_tps_list_categories()[1]))
if (!inherits(df, "try-error")) head(df)
#> OBJECTID EVENT_UNIQUE_ID REPORT_DATE OCC_DATE REPORT_YEAR REPORT_MONTH
#> 1 1 GO-20141259762 1.388552e+12 1.388466e+12 2014 January
#> 2 2 GO-20141264227 1.388552e+12 1.388552e+12 2014 January
#> 3 3 GO-20141263536 1.388552e+12 1.388552e+12 2014 January
#> 4 4 GO-20141264272 1.388552e+12 1.388552e+12 2014 January
#> 5 5 GO-20141262608 1.388552e+12 1.388552e+12 2014 January
#> 6 6 GO-20141263143 1.388552e+12 1.388552e+12 2014 January
#> REPORT_DAY REPORT_DOY REPORT_DOW REPORT_HOUR OCC_YEAR OCC_MONTH OCC_DAY
#> 1 1 1 Wednesday 2 2013 December 31
#> 2 1 1 Wednesday 20 2014 January 1
#> 3 1 1 Wednesday 17 2014 January 1
#> 4 1 1 Wednesday 21 2014 January 1
#> 5 1 1 Wednesday 14 2014 January 1
#> 6 1 1 Wednesday 16 2014 January 1
#> OCC_DOY OCC_DOW OCC_HOUR DIVISION
#> 1 365 Tuesday 23 D52
#> 2 1 Wednesday 20 D11
#> 3 1 Wednesday 17 D54
#> 4 1 Wednesday 21 D14
#> 5 1 Wednesday 14 D14
#> 6 1 Wednesday 16 D32
#> LOCATION_TYPE PREMISES_TYPE UCR_CODE
#> 1 Bar / Restaurant Commercial 1430
#> 2 Single Home, House (Attach Garage, Cottage, Mobile) House 1430
#> 3 Open Areas (Lakes, Parks, Rivers) Outside 1430
#> 4 Apartment (Rooming House, Condo) Apartment 1420
#> 5 Streets, Roads, Highways (Bicycle Path, Private Road) Outside 1430
#> 6 Apartment (Rooming House, Condo) Apartment 1430
#> UCR_EXT OFFENCE CSI_CATEGORY HOOD_158 NEIGHBOURHOOD_158
#> 1 100 Assault Assault 164 Wellington Place (164)
#> 2 100 Assault Assault 091 Weston-Pelham Park (91)
#> 3 100 Assault Assault 058 Old East York (58)
#> 4 100 Assault With Weapon Assault 085 South Parkdale (85)
#> 5 100 Assault Assault 095 Annex (95)
#> 6 100 Assault Assault 037 Willowdale West (37)
#> HOOD_140 NEIGHBOURHOOD_140 LONG_WGS84 LAT_WGS84
#> 1 077 Waterfront Communities-The Island (77) -79.39079 43.64913
#> 2 091 Weston-Pelham Park (91) -79.45876 43.66860
#> 3 058 Old East York (58) -79.34826 43.69363
#> 4 085 South Parkdale (85) -79.42053 43.63831
#> 5 095 Annex (95) -79.41842 43.66356
#> 6 037 Willowdale West (37) -79.41460 43.77170
# }