I have two sets of data - the first is a list of lat/long coordinates for 2,500 sites where trees have been measured, and the second is a list of lat/long coordinates for 88 temperature monitoring sites. I want to match each of the 2,500 sites in to its temperature monitoring site.
what i have so far is
distance=geodists(lat.coord.A,long.coord.B,lat.coordB,long.coordB, K)
to calculate the distance between a site in data.set.A and data.set.B, and am looking into using the apply functions to get r perform this for each of the 88 temp. sites at once.
i'm then playing with using min() to give the smallest distance from the site in data.set.A to any of those in data.set.B, but i'd rather just get the coordinates of that specific site in data.set.B than have to calculate it myself.
I'm sure this can be done relatively simply but can't seem to get it right. I'm pretty new to R so any help is very much appreciated!