If/else if: pick first matching record within set distance only after first condition is not met in R
问题 I would like to pick the closest previous owner within a set distance only after the first search condition isn't met. The locations are called reflo (reference location), and they have a corresponding x and y coordinates (called locx and locy , respectively). The conditions: if lifetime_census$reflo==owners$reflo.x[i] then condition is met if lifetime_census$reflo!=owners$reflo.x[i] , then find next closest record (within 30 meters) if there is no record within 30 meters, then assign NA