Created
February 16, 2012 08:35
-
-
Save rukku/1843347 to your computer and use it in GitHub Desktop.
Computes the angle between two vectors in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
theta <- acos( sum(a*b) / ( sqrt(sum(a * a)) * sqrt(sum(b * b)) ) ) | |
#taken from http://stackoverflow.com/questions/1897704/angle-between-two-vectors-in-r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment