Dear Baz, I'm inclined to believe that your general advice is correct. As a long-time APLer who came to R through Lisp-Stat, I think that it's generally a good idea not to resist the most natural way of programming in R.
On the other hand, introducing a new class and defining methods for it (such as a method for indexing) doesn't disturb standard methods, as your message seems to imply. Indeed, the ability to do these kinds of things is in my view one of the strengths of R (and S more generally). Of course, it is necessary to implement the new class carefully. Whether it is worth the trouble to have a class that accommodates zero-origin indexing seems to me to depend upon the application. I've never myself encountered an application where this was really desirable. Regards, John > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Barry > Rowlingson > Sent: Wednesday, March 31, 2004 8:38 AM > Cc: [EMAIL PROTECTED] > Subject: Re: [R] Zero Index Origin? > > Gabor Grothendieck wrote: > > If you are willing to do it yourself you can define a class > for which > > indexing behaves that way. > > I'd like to prefix all these solutions with "Here's how to > do it, but don't actually do it you crazy fool". It's on a > par with redefining pi, or redefining '+'. And then redefining '<-'. > > These techniques have their proper place, and that would be > in the currently non-existent obfuscated R contest. > > No, the R-ish (iRish?) way is to index vectors from 1. > That's what the R gods intended! > > > Baz ______________________________________________ [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
