so basically I have two separate groups within a data frame: I have a names of locations and the associated latitude and longitude ranges, and then I have a list of exact lat and long values. What I want to do is for each EXACT lat/long pair, iterate through the lat/long RANGE to see if the pair falls within the range. If it does, I want to write the name of the location next to the lat/long pair.
So, my code DOES work. However, it takes about 40 minutes to run though. I don't know if this is normal or if I'm doing this in a terribly structured/inefficient way. Any thoughts and input would be creatively appreciated!
for (x in 1:35274) {
  lat = test[x,9]
  long = test[x,10]
  for (y in 1:1198) {
    if ((((test[y,3] <= lat) & (lat <= test[y,2])) &
         ((test[y,4] <= long) & (test[y,5] >= long))) == TRUE)
      test[x,12] <- test[y,1]
  }
}
 
     
    