I have two data sets including coordinates of certain points. I want to write a function that calculates the distance between the closest coordinate points that exist between both data sets.
How would I write this function that gives me a list of the distance between each of the closest coordinate points?
I have mapped the points so far on a ggplot map in R. But I want to calculate the distance between these points to make statistical inference.