Format convert STATS19 data into spatial (sf) object

format_sf(x, lonlat = FALSE)

Arguments

x

Data frame created with read_accidents()

lonlat

Should the results be returned in longitude/latitude? By default FALSE, meaning the British National Grid (EPSG code: 27700) is used.

Examples

x_sf = format_sf(accidents_sample)
#> 0 rows removed with no coordinates
sf:::plot.sf(x_sf)
#> Warning: plotting the first 9 out of 30 attributes; use max.plot = 30 to plot all