Skip to content
Prev 120895 / 398498 Next

apply & incompatible dimensions error

Then try this:

cor(t(mat1), t(mat2))

Also note

1. the above implies that mat1 and mat2 must have the same
number of columns since if x and y are vectors cor(x,y) only makes
sense if they have the same length.

2. the usual convention is that variables are stored as columns
andt that rows correspond to cases so typically you would have
(in terms of your mat1 and mat2):

Mat1 <- t(mat1)
Mat2 <- t(mat2)

and then use Mat1 and Mat2, e.g. cor(Mat1, Mat2)
On 7/24/07, Bernzweig, Bruce (Consultant) <bbernzwe at bear.com> wrote: