if (FALSE) {
# path from case 1 to nearest pump.
walkingPath(1)
# path from pump 1 to nearest case.
walkingPath(NULL, 1)
# path from case 1 to pump 6.
walkingPath(1, 6)
# exclude pump 7 from consideration.
walkingPath(1, -7)
# path from case 1 to case 6.
walkingPath(1, 6, type = "cases")
# path from pump 1 to pump 6.
walkingPath(1, 6, type = "pumps")
# for multiple cases.
lapply(1:3, walkingPath)
# path from case 1 to nearest pump.
plot(walkingPath(1))
# path from John Snow's residence to Broad Street pump.
plot(walkingPath("John Snow", 7))
}
Run the code above in your browser using DataLab