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,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 > [,1] [,2] [,3] [,4] > [1,] 0 8 6 -1 > [3,] 2 4 8 1 > [4,] 1 0 9 -1 > > > test > [,1] [,2] [,3] [,4] > [1,] 1 0 1 1 > [3,] 3 5 2 -1 > [4,] 4 1 0 1 > > I have tried with > matrix(train %in% test, dim(train)) > apply(train, 1, paste, collapse="") %in% apply(test, 1, paste, > collapse="") > > It doesn't work. > How can I do. > Thanks for any help. > > Best, Muhammad Subianto > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.