Skip to content

Instantly share code, notes, and snippets.

@giacecco
Last active December 24, 2015 23:48
Show Gist options
  • Save giacecco/6882680 to your computer and use it in GitHub Desktop.
Save giacecco/6882680 to your computer and use it in GitHub Desktop.
Checking Telefonica's 9 - 15 December 2012 data for completeness...
checkFootfallCompleteness2 <- function () {
dec09 <- read.csv("../../reference data/Telefonica/footfall-London-09-dec-2012-15-dec-2012.csv.gz")
allAreas <- unique(dec09$Grid_ID)
print (paste("The total number of grid id areas referenced in the file is ", length(allAreas)))
for (d in unique(dec09$Date)) {
print (paste("Checking", d))
areas <- unique(subset(dec09, Date == d)$Grid_ID)
if (length(areas) < length(allAreas)) {
missingAreas <- allAreas[!(allAreas %in% areas)]
print ("The missing areas are")
print (paste(missingAreas, sep = ", "), sep = " ", collapse = NULL)
}
}
}
> checkFootfallCompleteness2()
[1] "The total number of grid id areas referenced in the file is 23152"
[1] "Checking 10/12/2012"
[1] "The missing areas are"
[1] "1122333312233" "1122333312341" "1122333312344" "1122333312432" "1122333321343"
[1] "Checking 11/12/2012"
[1] "The missing areas are"
[1] "1122333312341" "1122333312343" "1122333312344" "1122333312432" "1122333313212" "1122333321343"
[7] "1122333432334"
[1] "Checking 12/12/2012"
[1] "The missing areas are"
[1] "1122333312411" "1122333321343"
[1] "Checking 13/12/2012"
[1] "The missing areas are"
[1] "1122333131133" "1122333131422" "1122333312144" "1122333312341" "1122333312343" "1122333312344"
[7] "1122333313212" "1122333324122" "11223334111233" "11223334112144" "11223334112411" "11223334112412"
[13] "11223334112413" "11223334112414" "11223334112442"
[1] "Checking 14/12/2012"
[1] "The missing areas are"
[1] "112233122312" "112233122313" "1122333312144" "1122333312233" "1122333312341" "1122333312344"
[7] "1122333312411" "1122333321343" "11223334111233" "11223334112144" "11223334112411" "11223334112412"
[13] "11223334112413" "11223334112414" "11223334112442"
[1] "Checking 15/12/2012"
[1] "The missing areas are"
[1] "1122332344123" "1122333312144" "1122333312341" "1122333312343" "1122333312344" "1122333312411"
[7] "1122333312432" "1122333313212"
[1] "Checking 09/12/2012"
[1] "The missing areas are"
[1] "1122313323" "1122313324" "1122313331" "1122313332" "1122313333" "1122313334"
[7] "1122313343" "1122324411" "1122324412" "1122324413" "1122324414" "1122324441"
[13] "1122324444" "1122331111" "1122342221" "1122342222" "11223133433" "11223133434"
[19] "11223244123" "11223244132" "11223311141" "11223422113" "11223422121" "11223422122"
[25] "11223422141" "11223422142" "11223422214" "11223422224" "11223422232" "11223434244"
[31] "112231333441" "112231333444" "112234221123" "112234221213" "112234221214" "112234221222"
[37] "112234221223" "112234221224" "112234221233" "112234221241" "112234222111" "112234222114"
[43] "112234222141" "112234222144" "1122333134124" "1122333312233" "1122333312341" "1122333312343"
[49] "1122333312344" "1122333313212" "1122333321343" "1122333324122" "1122342212112" "1122342212121"
[55] "1122342212122" "1122342212123" "1122342212124" "1122342212211" "1122342212214" "1122342212313"
[61] "1122342212321" "1122342212322" "1122342212323" "1122342212324" "1122342212331" "1122342212334"
[67] "1122342212342" "1122343424143" "1122343424144" "1122343424411" "1122343424412" "1122343424413"
[73] "1122343424414" "1122343424441" "1122343424442" "1122343424443" "1122343424444" "1122343431112"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment