I think all you need is bearing <- function(x, y) atan2(y, x)*180/pi
This gives the bearing in degrees from the origin. If you wanted the bearing from some other point, just take the differences: bearing <- function(x, y, origin = c(x=0,y=0)) atan2(y-origin["y"], x-origin["x"])*180/pi Bill Venables http://www.cmis.csiro.au/bill.venables/ -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of pecardoso Sent: Tuesday, 28 July 2009 9:40 AM To: r-help@r-project.org Subject: [R] Get bearing for cartesian coordinates Is it possible to get bearing in degrees from Cartesian (not lat long) coordinates? [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.