I’ve got a data frame that represents points in a plane.
x y
1 0.0 0.0
2 0.2 0.0
3 0.3 -0.1
...
I want to write a diff-like function for that data. I’ve written the distance function myDist (not Euclidean), but how can I apply it to the data frame?
That is: By calling someFunction( myData, myDist ), I want to obtain a vector with the values myDist(myData[1,],myData[2,]), myDist(myData[2,],myData[3,]), myDist(myData[3,],myData[4,]), …
Is there a function that does this, or do I have to write a loop?
Solved it with
lapply: