I am trying to get Longitude and Latitude based on a location. the script works fine until it gets NA value. I have tried to use if, trycatch, is.na and many other functions but nothing works
The aim is, i get latitude and longitude based on Location. Many values are missing in this csv file. So i need something that can avoid NA values. Is there any other way to get there ? Thanks
for(i in 1:nrow(MassShooting)){
Data <- geocode(MassShooting$Location[i], output = "latlona", source = "google")
MassShooting$Longitude[i] <- as.numeric(Data[1])
MassShooting$Latitude[i] <- as.numeric(Data{2])
}
Aucun commentaire:
Enregistrer un commentaire