Hello, 

Do you mean exactly any 2 columns.  What if the value is equal in more than 2 
columns? 

> 
> I built a data frame "grid" (below) with 4 columns. I want to exclude
> all rows that have equal values in ANY 2 columns. Here is how I am
> doing it:
> 
> index<-expand.grid(1:4,1:4,1:4,1:4)

If a value is equal in 2 or more rows, i.e., duplicated, then the following 
should work, assuming index can be changed to a matrix for apply ... 

t3 <- index[apply(index, 1, function(x) all(!duplicated(x))),]

______________________________________________
[email protected] 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.

Reply via email to