[R] The R Inferno
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Fri Jan 9 18:52:08 CET 2009
Ajay ohri wrote:
> excellent adaptation of Dante and R with real common sense tips to help
> beginners especially ..goes to the blogroll......
> now if only i could get tips to sort a 5 column * 1 million rows dataset in
> less than ..eternity....
Er, that's a fairly short eternity:
> x <- data.frame(rnorm(1e6),rnorm(1e6),rnorm(1e6),rnorm(1e6),rnorm(1e6))
> names(x) <- letters[1:5]
> system.time(y <- x[order(x$a),])
user system elapsed
3.259 0.160 3.435
> head(y)
a b c d e
227944 -4.418977 0.9635349 0.2477897 -0.10172584 0.09840375
492006 -4.327607 -1.4967631 -0.3467700 0.53053492 -0.80043595
89830 -4.285324 -2.0491949 -2.2024725 -0.34946013 -0.63538249
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list