if (requireNamespace("sf", quietly = TRUE)) {
library(sf)
data(cycle_hire)
# or
cycle_hire <- st_read(system.file("shapes/cycle_hire.geojson", package="spData"))
plot(cycle_hire)
}
if (FALSE) {
# Download the data
cycle_hire = readr::read_csv("http://cyclehireapp.com/cyclehirelive/cyclehire.csv",
col_names = FALSE, skip = TRUE)
cycle_hire = cycle_hire[c_names]
c_names = c("id", "name", "area", "lat", "lon", "nbikes", "nempty")
cycle_hire = st_sf(cycle_hire, st_multipoint(c_names[c("lon", "lat")]))
}
Run the code above in your browser using DataLab