Estimated people, I have two matrices: ar1 <- array(data=c(1:16),dim=c(4,4)) ar2 <- array(data=c(1,2,3,3,5:16),dim=c(4,4)) They only differ in the fourth row. I would like to compare them in order to know which columns are equal. The following works, but I would like to have a better solution, and not to use what someone called "prehistorical loops": for(i in c(1:4)) { cat(as.character(i),": ", as.character(setequal(ar1[i,],ar2[i,])), "\n") } 1 : TRUE 2 : TRUE 3 : TRUE 4 : FALSE I cannot devise how to use the apply function for this. Thanks a lot, Federico __________________________________________________
[[alternative HTML version deleted]] ______________________________________________ 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.