Closed layik closed 5 years ago
I think we should write a function to 🚿 the names.
E.g.:
names_new[3] = "all"
names(d) = names_new
names(d)
# [1] "area_of_residence" "area_of_workplace"
# [3] "all" "work_mainly_at_or_from_home"
# [5] "underground_metro_light_rail_tram" "train"
# [7] "bus_minibus_or_coach" "taxi"
# [9] "motorcycle_scooter_or_moped" "driving_a_car_or_van"
# [11] "passenger_in_a_car_or_van" "bicycle"
# [13] "on_foot" "other_method_of_travel_to_work"
I know, I was going...please use Robin's code its already there, but ...what can I say :)
I like the code. I just dislike the column names that were provided by DfT. Like with stats19 I suggest we impose our own 'good' column names on them at the outset. The earlier we clean the names (e.g. with mode_names_clean()
the better.
We can just use that...
And, to be fair, just hard-coding them would be fine.
Right. Done deal, can we do it without tidyverse
?
Let me send the PR as I am not sure why it cannot find the new awesome get_centroid
function.
"faithful to the data" :)
btw
get_centroids_ew = function() {
u = "https://opendata.arcgis.com/datasets/b0a6d8a3dc5d4718b3fd62c548d60f81_0.csv"
pwc = readr::read_csv(u)
sf::st_as_sf(x = pwc[c("X", "Y", "msoa11cd", "msoa11nm")], coords = c("X", "Y"), crs = 4326)
}
zones_all = get_centroids_ew()
#> Parsed with column specification:
#> cols(
#> X = col_double(),
#> Y = col_double(),
#> objectid = col_double(),
#> msoa11cd = col_character(),
#> msoa11nm = col_character()
#> )
pryr::object_size(zones_all)
#> 2 MB
Created on 2019-03-08 by the reprex package (v0.2.1)
I think we just save a subset for Leeds. Keep the pkg data minimal - hence using 10 not 100 desire lines for Leeds.
Plus we can always create a supporting pctdata
pkg.
Yes. The readr
may be the only tidyverse
pkg we use.
Job. Done.
In base r but
requires
ukboundaries and stplanr.Thoughts @Robinlovelace. I can send a PR too.