[R] Performance note: Preallocating helps? and two questions
Peter Perkins
pperkins at ucsd.edu
Wed Nov 1 19:51:52 CET 2000
> AUcap30<-0
> for(i in 1:length(AU))AUcap30[i]<-min(30,AU[i])
am i right in thinking that this is an implicit version of
for(i in 1:length(AU)) AUcap30 <- c(AUcap30, min(30,AU[i])) ?
huh. i guess i'm surprised that this even works at all. i don't see
any specific mention in section 3 of the FAQ, and a quick look at the R
intro documents turned up no mention either. but i seem to remember
that it would not work in S (not that that is necessarily a reason for
it not to work in R). i kind of _like_ having array bounds checking --
is "array extension on out of bounds indexing" really the default in R,
and is there a way to enforce array bounds checking?
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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