Displaying 1 result from an estimated 1 matches for "dar2".
Did you mean:
dar
2011 Jul 12
1
Avoiding loops to detect number of coincidences
...ht.
n and m are the col and row of pru (m is the same number in pru and ht)
I tried this with loops
n<-nrow(pru)
m<-ncol(pru)
dacc2<-mat.or.vec(n, m)
for (g in 1:n){
for (j in 1:m){
if(pru[g,j]-ht[1,j]!=0) dacc2[g,j]=0 else {dacc2[g,j]=1}
}
}
So when I have dacc2 I can filter this:
dar2<-pru[colSums(dacc2)>2 & colSums(dacc2)<10,]
There is some way to avoid loops?
[[alternative HTML version deleted]]