Re: [R] enable object name to be called as object (a dataset)

2007-09-08 Thread Jim Price
a - 1:3 b - 11:13 c - 21:23 names - c('a','b','c') do.call(data.frame, list(sapply(names, function(x) get(x runner wrote: What I am trying to do is as follows: - I have listed names of all wanted objects (datasets A,B,C... ) in current workspace as a vector: obj -

[R] enable object name to be called as object (a dataset)

2007-09-07 Thread runner
What I am trying to do is as follows: - I have listed names of all wanted objects (datasets A,B,C... ) in current workspace as a vector: obj - c('A','B','C') - then i need to use these objects, say to extract all the 1st columns and bind to an existing dataset ('data'): for ( i in 1:3){

Re: [R] enable object name to be called as object (a dataset)

2007-09-07 Thread Giovanni Petris
This should work: do.call(cbind, lapply(1:length(obj), function(i) get(obj[i])[,1])) Best, Giovanni Date: Fri, 07 Sep 2007 14:42:07 -0700 (PDT) From: runner [EMAIL PROTECTED] Sender: [EMAIL PROTECTED] Precedence: list What I am trying to do is as follows: - I have listed names of

Re: [R] enable object name to be called as object (a dataset)

2007-09-07 Thread Gabor Csardi
get might be good enough for you: a - 10 name - a get(a) [1] 10 get(name) [1] 10 Gabor On Fri, Sep 07, 2007 at 02:42:07PM -0700, runner wrote: What I am trying to do is as follows: - I have listed names of all wanted objects (datasets A,B,C... ) in current workspace as a vector: