I have a data frame that boiled down looks like:
dat <- data.frame(longitude = c(80.15998, 72.89125, 77.65032, 77.60599), 
                latitude = c(12.90524, 19.08120, 12.97238, 12.90927),
                site = c("a", "b", "c", "d"), 
                source = c("K", "K",  "P", "P"))
I would like to figure out how to find distances between each possible pairing of the sites (so pairing a-b, a-c, a-d, b-c, etc.). So the end result might look like
        a    b    c    d
 a      
 b
 c
 d
with the distances filled in obviously.
I know for distance that I should be using library(geosphere) and distm() or distHaversine() ? 
Any help is appreciated!
 
    