Gabor Grothendieck wrote:
>> set.seed(1)
>> C <- sample(c("a", "b"), 100000, replace = TRUE)
>> system.time(s1 <- ifelse(C == "a", 1, -1))
>>     
>    user  system elapsed
>    0.37    0.01    0.38
>   
>> system.time(s2 <- 2 * (C == "a") - 1)
>>     
>    user  system elapsed
>    0.02    0.00    0.02
>   
> system.time(s1 <- ifelse(C == "a", 1, -1))
   user  system elapsed
   0.04    0.01    0.08
> system.time(s2 <- 2 * (C == "a") - 1)
   user  system elapsed
      0       0       0


I am just wondering: how comes the time does add up to 0.05 while
elapsed states 0.08 on my system? (Vista+R2.5.1)

Stefan


-=-=-
... Time is an illusion, lunchtime doubly so. (Ford Prefect)

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to