Skip to content
Prev 275464 / 398506 Next

Create a matrix with increment and element with zero subscript

R. Michael Weylandt wrote:
I'd think about constructs like 
income[1990:2010]

which work nicely with arbitrary indexing. (Oarray isn;t just 0)

Fortran has it natively; C doesn't, but it was useful enough for Numerical Recipes to provide code for arbitrary array index origin for C arrays (it used a pointer shift, if I recall correctly). The most obvious native R appraoch I can think of is using names (eg income[paste(1990:2010)] ), which is very general but has its own disadvantages in terms of readability and, maybe, speed. 

 S Ellison
LGC*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}