Skip to content

Instantly share code, notes, and snippets.

@giacecco
Created July 21, 2015 14:08
Show Gist options
  • Select an option

  • Save giacecco/870b5c4398ac273aea65 to your computer and use it in GitHub Desktop.

Select an option

Save giacecco/870b5c4398ac273aea65 to your computer and use it in GitHub Desktop.
# now, how many addresses and what % of the total can I get from LRPP over the estimated total?
lr_pp_with_house_names <- tbl(src_postgres("olaf"), sql("SELECT DISTINCT street, town, paon, saon FROM lr_pp WHERE street IS NOT NULL"))
no_addresses_I_know_from_lrpp <- collect(lr_pp_with_house_names %>% filter(town == target_town) %>% summarise(no_of_addresses = n()))$no_of_addresses
perc_I_know_from_lrpp = no_addresses_I_know_from_lrpp / total_addresses_in_town
# and display what I am missing
total_addresses_in_town - no_addresses_I_know_from_lrpp
1 - perc_I_know_from_lrpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment