[R] Calculate directions between points

Wanja Mathar maenner_wg at yahoo.de
Sat Mar 28 17:06:16 CET 2009


Hi everyone,

i have a matrix of points and want to calculate the direction and length of each vector between the points.

I can easily calculate the length with dist(testdata), but is their a function that returns a matrix of the direction of the vectors between points (angles 0-360°)?

testdata <- matrix(1:8, nrow=4, ncol=2,
                dimnames=list(c("A","B","C","D"), c("x","y"))







More information about the R-help mailing list