Herve Pages wrote:
...
> But if, instead of the above, I do this:
>
> > for (i in nrow(dat)) { row <- sapply(dat, function(col) col[i]) }
Should have been:
> for (i in 1:nrow(dat)) { row <- sapply(dat, function(col) col[i]) }
>
> then it's 20 times faster!!
>
> > system.time(for (i in 1:100) { row <- sapply(dat, function(col) col[i]) })
> user system elapsed
> 0.576 0.096 0.673
...
Cheers,
H.
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel