Skip to content
Prev 311795 / 398503 Next

Help!!!!!

Hello,

Right, sorry, it should be nrow(x). I had created a variable nr <- 
nrow(x) and forgot to check it after changing it.


incub <- function(x){
     x$Incubation <- 0
     x$Incubation[1] <- x$Symptomes[1]
     if(nrow(x) > 1)
         x$Incubation[2] <- sum(x$Symptomes[1:2])
     for(i in seq_len(nrow(x))[-(1:2)])
         x$Incubation[i] <- sum(x$Symptomes[i - (0:2)])
     x
}


Now it works.

Rui Barradas
Em 24-11-2012 18:18, arun escreveu: