Here is my code # determine the DDOA measurements for(e in 1:numSensors) { for(f in 1:numSensors) { if((combos[e,f]==1) { # true distance between each sensor and the target truedistance[e]<-sqrt((targetX-sensorX[e])^2+(targetY-sensorY[e])^2) # add an error that has a N(0, sigma^2) distribution truedistance[e]<-(truedistance[e]+rnorm(1, 0, sigma)) } #truedistance[1] <- (truedistance[1]+50)
#determine DDOA measurements (reference sensor is sensor #1 here) index<-1 for(e in 1:numSensors) { if(e!=r) { measurement[index]<-(truedistance[f]-truedistance[e]) index <- (index+1) } } } if(combos[e,f]!=1) { } } combos is just a matrix containing 1's and 0's This error keeps appearing Error in if (combos[e, f] == 1) { : missing value where TRUE/FALSE needed Any ideas? -- View this message in context: http://r.789695.n4.nabble.com/TRUE-FALSE-tp2318668p2318668.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.