You can just call `c` on your result to flatten the matrix into a
vector. You could also eliminate the for-loops by using the `apply`
function:
pairwise_setequal <-
function(a,b) c(apply(a, 1, function(r){ apply(b, 1, setequal, r ) } ))
But are you sure that is what you want to do? In the ca
Try:
c(inner(testmat1, testmat2, setequal))
where inner is defined here:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/70762.html
On Mon, Nov 10, 2008 at 10:11 AM, Chris82 <[EMAIL PROTECTED]> wrote:
>
> Hello R-users,
>
> I have a little problem.
>
> I compare each row of a matrix with each ro
Hi Chris82,
Yes. Try this:
testmat1 <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4)
testmat2 <- matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4)
b=NULL
for (i in 1:4){
for (j in 1:4){
b <- c(b,setequal(testmat1[j,],testmat2[i,]))
b
}
}
b
HTH,
Jorge
On Mon, Nov 10, 200
Hello R-users,
I have a little problem.
I compare each row of a matrix with each row of another matrix.
testmat1 <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4)
testmat2 <- matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4)
Both matrix differs in the last row.
Now I create
4 matches
Mail list logo