[R] Zero Index Origin?

kjetil@entelnet.bo kjetil at entelnet.bo
Wed Mar 31 23:00:00 CEST 2004


On 31 Mar 2004 at 14:38, Barry Rowlingson wrote:

> 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 '<-'.

You mean

> y <- 5
> "<-" <- function(x,value) x+value
> y
[1] 5
> y <- 5
[1] 10

(but remember not to save the workspace)

> 
>   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! 

But not everybody listens to the gods! On CRAN there is a blasfemish 
package called
Oarray

Kjetil Halvorsen

> 
> 
> Baz
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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




More information about the R-help mailing list