While the remedy for your dissatisfaction with my previous solution should be obvious, I will make it explicit. # that is rows containing at most one value > 0.8 # ignoring the diagonal keeprows<-apply(ro246,1,function(x) return(sum(x>0.8)<2)) ro246.lt.8<-ro246[keeprows,keeprows] Jim