I've got a dataframe with coordinates (lon, lat)
lon <- list(505997.627175236, 505997.627175236, 505997.627175236, 505997.627175236)
lon <- do.call(rbind.data.frame, lon)
lat <- list(7941821.025438220, 7941821.025438220, 7941821.025438220, 7941821.025438220)
lat <- do.call(rbind.data.frame, lat)
coord <- cbind(lon, lat)
colnames(coord) <- c("lon", "lat")
I'm trying to calculate the euclidian distance and the angle between all the possible row combinations within the dataframe.
lon lat apply function on every possible combinations such as v1-v2, v1-v3, v1-v4,
v1 x1 y1 v2-v3 and so on...
v2 x2 y2
v3 x3 y3 here are the two functions applied beetween v1 and v2 :
v4 x4 y4 **euclidian distance** sqrt((x1-x2)^2 + (y1-y2)^2)
**angle** atan2((y1-y2),(x1-x2))*(180/pi)
How to apply several functions on every possible row combinations and get the results in respective lists ? My goal is to use these calculations at every iteration whatever the number of row in input.
Thanks in advance for your answers and sorry if the question seems silly. I've looked at so many posts but couldn't find a solution that I could understand and replicate.