Yes, that was the problem. Now it's solved. Thanks a lot, Dong-Joon
On Sat, Mar 17, 2012 at 6:38 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > My guess is that you're not getting what you expect from operator > precedence: note that > > 1:3 - 1 > 1:(3-1) #Not equal > > If that doesn't fix it, you can use options(error = recover) to find > the values of your logical conditions at the exact moment an error is > thrown and see which one is NA but my money is on the above. > > Michael > > > On Sat, Mar 17, 2012 at 5:34 AM, Dong-Joon Lim <tgno3....@gmail.com> > wrote: > > Hello R friends, > > > > I've got error message as follows; > > > >> > >> n<-0 > >> roc<-array(0,c(ti-1,1)) > >> avgroc<-0 > >> > >> for(i in 1:ti-1){ > > + if(orientation=="in"){ > > + if(eff_p1[i,1,i]==1 && eff_p1[i,1,ti-1]<1 && ed[i,1]>d[i,1]){ > > + roc[i,1]<-(1/eff_p1[i,1,ti-1])^(1/(ed[i,1]-d[i,1])) > > + n<-n+1 > > + } > > + } > > + if(orientation=="out"){ > > + if(eff_p1[i,1,i]==1 && eff_p1[i,1,ti-1]>1 && ed[i,1]>d[i,1]){ > > + roc[i,1]<-(eff_p1[i,1,ti-1])^(1/(ed[i,1]-d[i,1])) > > + n<-n+1 > > + } > > + } > > + } > > Error in if (eff_p1[i, 1, i] == 1 && eff_p1[i, 1, ti - 1] < 1 && ed[i, : > > missing value where TRUE/FALSE needed > > > > I checked "eff_p1[i,1,i]==1 && eff_p1[i,1,ti-1]<1 && ed[i,1]>d[i,1]" for > > all i and it returned either TRUE or FALSE normally. > > Why it shows error message when I link it with repetitive execution (for > i > > in 1:ti-1)? > > All variables have been defined correctly including ti, orientation, > > eff_p1, and ed. > > > > Thanks in advance, > > DJ > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > 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. > [[alternative HTML version deleted]] ______________________________________________ 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.