Re: [R] How to compare rows of two matrices

2006-08-24 Thread Muhammad Subianto
Dear Stephen C. Upton & Petr Pikal Thank you both very much for the suggestions! Best wishes, Muhammad Subianto On this day 24/08/2006 12:03, Muhammad Subianto wrote: > Dear all, > I have a dataset > train <- cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) > test <- cbind(1:5, c(0,1,5

Re: [R] How to compare rows of two matrices

2006-08-24 Thread Petr Pikal
ammad Subianto" <[EMAIL PROTECTED]> To: r-help@stat.math.ethz.ch Subject: [R] How to compare rows of two matrices > Dear all, > I have a dataset > train <- cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) > test <- cbind(1:5,

Re: [R] How to compare rows of two matrices

2006-08-24 Thread Stephen C. Upton
Does this work for you? dd <- mapply("==",train,test) > dim(dd) <- dim(train) > dd [,1] [,2] [,3] [,4] [1,] FALSE FALSE FALSE FALSE [2,] TRUE FALSE FALSE TRUE [3,] FALSE FALSE FALSE FALSE [4,] FALSE FALSE FALSE FALSE [5,] FALSE FALSE FALSE TRUE HTH steve Muhammad Subianto wrote: >

[R] How to compare rows of two matrices

2006-08-24 Thread Muhammad Subianto
Dear all, I have a dataset train <- cbind(c(0,2,2,1,0), c(8,9,4,0,2), 6:10, c(-1, 1, 1, -1, 1)) test <- cbind(1:5, c(0,1,5,1,3), c(1,1,2,0,3) ,c(1, 1, -1, 1, 1)) I want to find which rows of train and test it different in its last column (column 4). The solution must be something like train