[R] Create a matrix with increment and element with zero subscript

R. Michael Weylandt michael.weylandt at gmail.com
Tue Oct 25 21:48:38 CEST 2011


Fair enough -- hadn't thought of going the other way. I do remember
looking at that C trick once, but I'm actually somewhat surprised
Fortan has it natively: I had always associated multiple basing with
something like VBA that has to keep everyone on board but no one
happy. Seems a surprisingly flexible feature for a language that
doesn't allow miniscule letters.

Michael

On Tue, Oct 25, 2011 at 8:45 AM, S Ellison <S.Ellison at lgcgroup.com> wrote:
>  R. Michael Weylandt wrote:
>>
>> This may be an unnecessary aside, but other than obfuscating
>> code or allowing people to never stop thinking in C and start
>> thinking in R, what practical purpose would this package
>> serve in an R context?
>>
>
> 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}}
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list