The Euclidean inner product <v, w> of vectors v, w is |v|*|w|*cos(angle).
So
you could first normalize the vectors to length 1, then if they are columns
of a matrix A, crossprod(A) ( = A'A) gives you the matrix of cosines.
Reid Huntsinger
-----Original Message-----
From: Petra Steiner [mailto:steinep at uni-muenster.de]
Sent: Wednesday, January 09, 2002 5:14 PM
To: r-help at lists.r-project.org
Subject: [R] Distance matrix by cosine?
Hello,
a. is there a possibility to obtain a distance matrix with the cosine
between vectors?? hclust, hierclust, dist will not work and seem to be hard
to extend.
b. if there is not: Is the cosine between vectors implemented somewhere?
Thanks for all hints and advice!
Petra Steiner
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
https://stat.ethz.ch/pipermail/r-help/attachments/20020110/d61b0288/attachment.html