You can define origin 0 objects yourself if you like. Here is a partial implementation:
"[.orig0" <- function(x, i) if (is.numeric(i)) .subset(x, i+0) else .subset(x, i) orig0 <- function(x) structure(x, class = c("orig0", setdiff(class(x), "orig0"))) x <- orig0(1:5) x[0:3] # 1:4 Note that usually 0 means leave out that element in R and in this implementation -1 means leave it out. Also normally -3 mean leave out 3rd element but in the implementation above -0 would be 0 so it would give the first element. Probably best to just get used to the R way. On Feb 18, 2008 6:31 PM, hill0093 <[EMAIL PROTECTED]> wrote: > > It looks to me like the index range starts at 1 in R. > Is this true? > If so, is there a way to change it to start at 0? > That way, I wouldn't have to make so many > changes when I translate a function from > another language. > -- > View this message in context: > http://www.nabble.com/index-range-tp15550797p15550797.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.