Bert,

we can save a lot of time by using paste and then only one call to eval and
parse.

> x2 <- c("1",    "2:5",  "3:6", "4",    "8",    "5:7",  "10")
> system.time(for (i in 1:100)  unlist(lapply(parse(text=x2),eval)))
   user  system elapsed
   0.06    0.00    0.03
> system.time(for (i in 1:100)  eval(parse(text=paste("c(",paste(x2,
collapse=","),")"))))
   user  system elapsed
   0.01    0.00    0.03
>

Rich

        [[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.

Reply via email to