[R] eval and as.name
Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Fri Feb 6 00:42:35 CET 2009
Marie Sivertsen wrote:
> Why do you use the equals sign for assignment instead of the arrow, is this
equal? you mean equivalent? mostly, yes. briefly, this is why:
1. a copy-over from other programming languages;
2. to avoid learning yet another operator;
3. after having learned the other operator, to avoid that ugly operator;
4. after an r guru complained here about people using this instead of
that, to annoy him.
> On Thu, Feb 5, 2009 at 11:59 PM, Wacek Kusnierczyk <
> Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
>> you may want to avoid this sort of indirection by using lists with named
>> d = list(a=c(1,3,5,7), b=c(2,4,6,8))
>> with(d, sum(a+b))
>> sum(d[['a']], d[['b']])
>> sum(sapply(n, function(v) d[[v]]))
>> and so on.
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help