[R] can't find the error in if function... maybe i'm blind?

Janosch Janosch1985 at web.de
Sat Oct 20 12:27:42 CEST 2012


Hi everybody,

the following alway gives me the error
 "Fehler in if (File$X.Frame.Number[a] + 1 == File$X.Frame.Number[a + 1])
(File$FishNr[a] <- File$FishNr[a -  :   Fehlender Wert, wo TRUE/FALSE nötig
ist". Maybe its stupid, but i'm not getting why... Maybe someone can help
me.  Thanks a lot!

for (i in unique(BigFile$TrackAll))
      { File <-  subset(BigFile,BigFile$TrackAll == i)
         File$FishNr [1]  <- 1
          for ( a in File$X.Frame.Number)
               {if(File$X.Frame.Number[a]+1==  File$X.Frame.Number[a+1])
                (File$FishNr [a] <- File$FishNr[a-1])
                else(if (File$X.Frame.Number[a]+1 !=
File$X.Frame.Number[a+1])
                      (File$FishNr [a] <- File$FishNr[a-1]+1   ))
           }
       }



--
View this message in context: http://r.789695.n4.nabble.com/can-t-find-the-error-in-if-function-maybe-i-m-blind-tp4646839.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list