[R] Performance note: Preallocating helps? and two questions
maechler at stat.math.ethz.ch
Thu Nov 2 10:02:22 CET 2000
>>>>> "Peter" == Peter Perkins <pperkins at ucsd.edu> writes:
>> for(i in 1:length(AU)) AUcap30[i] <- min(30,AU[i])
Peter> am i right in thinking that this is an implicit version of
Peter> for(i in 1:length(AU)) AUcap30 <- c(AUcap30, min(30,AU[i])) ?
yes (as others have said on this thread).
Peter> huh. i guess i'm surprised that this even works at all. i
Peter> don't see any specific mention in section 3 of the FAQ, and a
Peter> quick look at the R intro documents turned up no mention either.
(really, I thought it *was* there; no time to search now..)
Peter> but i seem to remember that it would not work in S (not that
Peter> that is necessarily a reason for it not to work in R).
yes, it has been working in S `since ever' (even before there was S+).
Peter> i kind of _like_ having array bounds checking -- is "array
Peter> extension on out of bounds indexing" really the default in R,
yes (and will be)
Peter> and is there a way to enforce array bounds checking?
not currently, but probably, there will be, by
options(check.bound = TRUE)
which is (only partly implemented) in the current development version.
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
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