Displaying 1 result from an estimated 1 matches for "mat1row1".
Did you mean:
mat1row
2007 Jul 24
1
cor inside/outside a function has different output
...what would seem to be two similar methods:
Method 1:
> f <- function(x,y) cor(x,y)
> apply(mat1, 1, f, y=mat2)
Method 2:
> cor(mat1, mat2)
However, the results (see blow) are different:
> apply(mat1, 1, f, y=mat2)
mat1row1 mat1row2 mat1row3 mat1row4 mat1row5
[1,] -0.27601028 -0.1352143 0.03538690 -0.03084075 -0.60171704
[2,] -0.01595532 -0.3881197 -0.43663982 0.49081806 0.33291995
[3,] 0.35969624 -0.0582948 0.57462169 0.09926796 -0.02948423
[4,] -0.41435920 -0.7164638 -0.21213496 -0.55183934 -0.2...