[R] While loop working with TRUE/FALSE?

Chris82 rubenbauar at gmx.de
Thu Feb 2 12:55:18 CET 2012

Thanks to Berend and the others,

I've found a solution which works fine for my problem.

I have not only 2 vectors, but also 4.
Question is, if q1 and q2 is equal to w1 and w2.
The computational time is very short, also for large data.

q1 <- c(9,5,1,5)
q2 <- c(9,2,1,5)

w1 <- c(9,4,4,4,5)
w1 <- c(9,4,4,4,5)

v <- vector()
for (i in 1:(length(q1))){
v[i] <- any((q1[i] == w1) &  (q2[i] == w2))

best regards

View this message in context: http://r.789695.n4.nabble.com/While-loop-working-with-TRUE-FALSE-tp4348340p4351214.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list