most likely 'combos[e,f]' is NA; take a look at your data. Also put options(error=utils::recover)
in your program so that when the error occurs you can learn to use the debugging mode to trace down the problem. On Mon, Aug 9, 2010 at 11:38 AM, Turn & Fall <turnandf...@live.co.uk> wrote: > > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.