Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pre-K
##################use address to get long/lat info################
kinder <- read.csv(url("https://github.com/amy17519/NYCPre-KGuide/blob/master/Universal_Pre-K__UPK__School_Locations.csv"),
stringsAsFactors=FALSE)
######paste zipcodes to all addresses to increase accuracy of locating
kinder$address<- paste(kinder$address,kinder$zip)
geo<-geocode(kinder$address) #use geocode from ggmap package to get longtitude/latitude coordinates
geo<-geo[,c(2,1)] #change col order of long and lat to match convention
#Find abnormal locations using longitude/latitude boundaries of NYC
#Northernmost pt:40.916541, -73.906637
#Southernmost pt:40.525095, -74.246319
#Easternmost pt:40.722813, -73.688498
#Westernmost pt:40.510940, -74.253454
#####there are 18 suspicious locations that might not be in NYC
index<-which(geo$lat>=40.916541 | geo$lat<= 40.525095 |
geo$lon>=-73.688498 | geo$lon<= -74.253454)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.