Hi David,
What you touched on is the art of statistical computing. You used a logical
function to only calculate angles between non-identical vectors and avoid NaN
values; our geomorph function turns off warnings and waits until the end and
replaces what should be computational 0 values with
Hi everyone,
Apologies to the group. In retrospect, despite the disclaimer in my first
email, better to have error checked before sending (as Mike noted, I wrote
acos not cos, and I borrowed from old code that assumed the vectors were
already unit length; I also made mistakes in how the loop was
Dear David, and others,
Be careful with the code you just introduced here. There are a couple of
mistakes. First, vectors need to be unit length. You code does not transform
the vectors to unit length. Second, it’s the arccosine, the cosine of the
vector inner product that finds the angle.
Andrea,
If you already have the matrix of coefficients, geomorph has an internal
function that can do what you seek to do. You can try this
geomorph:::vec.ang.matrix(myMatrix, type = “r”) # for vector correlations
geomorph:::vec.ang.matrix(myMatrix, type = “rad”) # for vector angles in radians
Dear All,
please, does anyone know if there's an R package that, using a matrix
with several vectors (e.g., coefficients for allometric regressions in
different taxa), will compute the pairwise (all possible pairs of taxa)
matrix of vector angles?
Thanks in advance for any suggestion.
Cheers