Re: [R] cor inside/outside a function has different output

2007-07-24 Thread Gabor Grothendieck
I think this is really answered already in my previous post but just in case try this: > res1 <- t(apply(mat1, 1, cor, t(mat2))) > res2 <- cor(t(mat1), t(mat2)) > all.equal(res1, res2, check.attributes = FALSE) [1] TRUE On 7/24/07, Bernzweig, Bruce (Consultant) <[EMAIL PROTECTED]> wrote: > I'm c

Re: [R] cor inside/outside a function has different output

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
: [R] cor inside/outside a function has different output I think this is really answered already in my previous post but just in case try this: > res1 <- t(apply(mat1, 1, cor, t(mat2))) > res2 <- cor(t(mat1), t(mat2)) > all.equal(res1, res2, check.attributes = FALSE) [1] TRUE On 7/2

[R] cor inside/outside a function has different output

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
I'm calculating correlations between two matrices mat1 <- matrix(sample(1:500,25), ncol = 5, dimnames=list(paste("mat1row", 1:5, sep=""), paste("mat1col", 1:5, sep=""))) mat2 <- matrix(sample(501:1000,25), ncol = 5, dimnames=list(paste("mat2row", 1:5, sep=""), paste("mat2col", 1:5,