[R] eval and as.name

2009-02-05 Thread Fuchs Ira
I'm sure there is a more general way to ask this question but how do you use the elements of a character vector as names of objects in an expression? For example, say you have: a = c(1,3,5,7) b = c(2,4,6,8) n=c(a,b) and you want to use the names a and b in a function (e.g. sum)

Re: [R] eval and as.name

2009-02-05 Thread Murray Cooper
-project.org Sent: Thursday, February 05, 2009 5:10 PM Subject: [R] eval and as.name I'm sure there is a more general way to ask this question but how do you use the elements of a character vector as names of objects in an expression? For example, say you have: a = c(1,3,5,7) b = c(2,4,6,8) n

Re: [R] eval and as.name

2009-02-05 Thread Wacek Kusnierczyk
Fuchs Ira wrote: I'm sure there is a more general way to ask this question but how do you use the elements of a character vector as names of objects in an expression? For example, say you have: a = c(1,3,5,7) b = c(2,4,6,8) n=c(a,b) and you want to use the names a and b in a function

Re: [R] eval and as.name

2009-02-05 Thread Wacek Kusnierczyk
: [R] eval and as.name I'm sure there is a more general way to ask this question but how do you use the elements of a character vector as names of objects in an expression? For example, say you have: a = c(1,3,5,7) b = c(2,4,6,8) n=c(a,b) and you want to use the names a and b

Re: [R] eval and as.name

2009-02-05 Thread Marie Sivertsen
Hi, Why do you use the equals sign for assignment instead of the arrow, is this equal? Mvh. Marie On Thu, Feb 5, 2009 at 11:59 PM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: you may want to avoid this sort of indirection by using lists with named components: d =

Re: [R] eval and as.name

2009-02-05 Thread Wacek Kusnierczyk
Marie Sivertsen wrote: Hi, Why do you use the equals sign for assignment instead of the arrow, is this equal? 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

Re: [R] eval and as.name

2009-02-05 Thread Fuchs Ira
:25:39 2009 Subject: RE: [R] eval and as.name Hi: below works but it's not much shorter than yours. there must be a better way so I'm sending off line in order to encourage better replies. sum(get(n[1]),get(n[2])) On Thu, Feb 5, 2009 at 5:10 PM, Fuchs Ira wrote: I'm

Re: [R] eval and as.name

2009-02-05 Thread Fuchs Ira
the elements of the character vector. Thanks, Ira - Original Message - From: markle...@verizon.net markle...@verizon.net To: Fuchs Ira irafu...@gmail.com Sent: Thu Feb 05 17:25:39 2009 Subject: RE: [R] eval and as.name Hi: below works but it's not much shorter than yours. there must

Re: [R] eval and as.name

2009-02-05 Thread Gabor Grothendieck
the elements of the character vector. Thanks, Ira - Original Message - From: markle...@verizon.net markle...@verizon.net To: Fuchs Ira irafu...@gmail.com Sent: Thu Feb 05 17:25:39 2009 Subject: RE: [R] eval and as.name Hi: below works but it's not much shorter than yours. there must

Re: [R] eval and as.name

2009-02-05 Thread Dieter Menne
Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no writes: 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