[R] Performance note: Preallocating helps? and two questions

Bob Sandefur rls at pincock.com
Wed Nov 1 15:00:41 CET 2000


hi-
 in r 1.1 on windows 2000
 with length(AU) of 35833
 AUcap30<-0
 for(i in 1:length(AU))AUcap30[i]<-min(30,AU[i]) 
took over an hour on pentium II 300 mhertz (I esc'ed before it finished)
but
AUcap30<-AU 
 for(i in 1:length(AU))AUcap30[i]<-min(30,AU[i]) 
is very quick (a few seconds)

Is this performance difference common in r (ie is linux the same way)?

Are there other tricks to speed up R (in windows) (besides a faster processor and more memory)?

thanx

bob sandefur

Principal Geostatistician
Pincock Allen & Holt
International Minerals Consultants
274 Union Suite 200
Lakewood CO 80228
USA
303 914-4467  v
303 987-8907 f



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list