Dear Bob, One approach would be to introduce a class of objects for which zero-based indexing is implemented. Here's a simple example:
> "[.io0" <- function(x, i) as.vector(x)[i + 1] > > v <- 0:10 > class(v) <- "io0" > v[0] [1] 0 > v[0:5] [1] 0 1 2 3 4 5 > Of course, a serious implementation would handle arrays and perhaps other kinds of objects, and would be more careful about the subscript. I hope that this helps, John > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bob Cain > Sent: Wednesday, March 31, 2004 3:16 AM > To: R-help > Subject: [R] Zero Index Origin? > > > I'm very new to R and utterly blown away by not only the > language but the unbelievable set of packages and the > documentation and the documentation standards and... > > I was an early APL user and never lost my love for it and in > R I find most of the essential things I loved about APL > except for one thing. At this early stage of my learning I > can't yet determine if there is a way to effect what in APL > was zero index origin, the ordinality of indexes starts with > 0 instead of 1. Is it possible to effect that in R without a > lot of difficulty? > > I come here today from the world of DSP research and > development where Matlab has a near hegemony. I see no > reason whatsoever that R couldn't replace it with a _far_ > better and _far_ less idiosyncratic framework. I'd be > interested in working on a Matlab equivalent DSP package for > R (if that isn't being done by someone) and one of the things > most criticized about Matlab from the standpoint of the DSP > programmer is its insistence on 1 origin indexing. > Any feedback greatly appreciated. > ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
