[R] Zero Index Origin?
Lutz Prechelt
prechelt at pcpool.mi.fu-berlin.de
Thu Apr 1 10:13:37 CEST 2004
Bob,
on a remark about Brian Ripley's remark
if you're actually using indicies explicitly,
you probably haven't wrapped your head around
how powerful the indexing structure and
"whole object" approach is in S and in R,
Gabor Grothendieck wrote:
> I believe the point was not so much that R has powerful indexing
> (which it does) but that the capabilities of dealing with objects as
> a whole, i.e. without using indexing at all, makes facilities for
> indexing less important.
I believe what REALLY makes the question of zero origin versus
1-origin fairly unimportant is the fact that even when you use
indexing, you rarely need to know what the index numbers are.
In typical indexing expressions such as
x[y==z]
(that is, selecting a subset from one vector, based on agreement
between two other vectors) you just do not care whether the index
numbers that are used implicitly in the process start at
0, 1, or, for that matter, 314.
And, as Brian Ripley has also pointed out: even the expressions
of the form 1:n should 1:n usually rather be someting like
seq(length=n) or seq(along=x) instead, which again would even
allow indexing starting at 314 (and progressing in steps of 17 if
you'd like).
Lutz
Prof. Dr. Lutz Prechelt; prechelt at inf.fu-berlin.de
Institut für Informatik; Freie Universität Berlin
Takustr. 9; 14195 Berlin; Germany
+49 30 838 75115; http://www.inf.fu-berlin.de/inst/ag-se/
More information about the R-help
mailing list