-
-
Save giacecco/44eff5f4c9bc1727b40e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load ONS' pcd11_oa11_lsoa11_msoa11_lad11_ew_lu dataset and get the list of output areas for the | |
# relevant postcodes | |
onspcenum_oas <- unique((read.csv(pipe("unzip -qc \"/Users/giacecco/Data archive/ons/pcd11_oa11_lsoa11_msoa11_lad11_ew_lu/150725/Postcodes_(Enumeration)_(2011)_to_output_areas_(2011)_to_lower_layer_SOA_(2011)_to_middle_layer_SOA_(2011)_to_local_authority_districts_(2011)_E+W_lookup.zip\" *.csv"), na.strings = c(""), stringsAsFactors = F) %>% filter(PCD7 %in% union(lrpp_postcodes$pcd, oson_postcodes$pcd)))$OA11CD) | |
# load ONS' NSAL for the relevant output areas | |
onsnsal_property_no <- collect(tbl(src_postgres("olaf"), sql(paste0("SELECT COUNT(uprn) AS no_of_properties FROM ons_nsal WHERE oa11 IN (", paste0("'", onspcenum_oas, "'", collapse=", "), ")", collapse = ""))))$no_of_properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> onsnsal_property_no | |
[1] 237702 | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment