Re: [R] a simple list question

2012-11-07 Thread William Dunlap
ect.org] On > Behalf > Of David L Carlson > Sent: Wednesday, November 07, 2012 8:25 AM > To: 'Rui Barradas'; 'Erin Hodgess' > Cc: 'R help' > Subject: Re: [R] a simple list question > > Combining your, Rolf, and Michael's suggestions makes

Re: [R] a simple list question

2012-11-07 Thread David L Carlson
e Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Rui Barradas > Sent: Wednesday, November 07, 2012 9:49 AM > To: Erin Hodgess > Cc: R help > Subject: Re: [R] a simple list ques

Re: [R] a simple list question

2012-11-07 Thread Rui Barradas
Hello, My solution is too complicated, the assign() is not needed. lapply( ls()[grep("^x\\.[[:digit:]]+$", ls())], get) Hope this helps, Rui Barradas Em 07-11-2012 11:44, Rui Barradas escreveu: Hello, Try the following. x.1 <- 1:3 y.1 <- 1:4 x.2 <- 5:10 vecs <- ls()[grep("^x\\.[[:digit:

Re: [R] a simple list question

2012-11-07 Thread arun
;  "x.2"  "x.3"  "y.1" #[11] "y.2" lapply(strsplit(ls()[grep("x|y",ls())],""),function(x) get(paste(x,collapse=""))) #[[1]] #[1] 1 2 3 # #[[2]] #[1] 1 2 3 4 # #[[3]] #[1]  5  6  7  8  9 10 # #[[4]] #[1] 5 6 # #[[5]] #[1]  8 

Re: [R] a simple list question

2012-11-07 Thread Rui Barradas
Hello, Try the following. x.1 <- 1:3 y.1 <- 1:4 x.2 <- 5:10 vecs <- ls()[grep("^x\\.[[:digit:]]+$", ls())] lapply(vecs, function(.x) assign(.x, get(.x))) Then you can use vecs to attribute names() to the result. Hope this helps, Rui Barradas Em 07-11-2012 05:35, Erin Hodgess escreveu: De

Re: [R] a simple list question

2012-11-07 Thread Michael Weylandt
On Nov 7, 2012, at 6:07 AM, Rolf Turner wrote: > On 07/11/12 18:35, Erin Hodgess wrote: >> Dear R People >> >> I have a simple list question, please: >> >> I have vectors x.1, x.2,...x.n (each of different lengths) and I would >> like to combine them into a list. >> >> However, I'm sure that

Re: [R] a simple list question

2012-11-06 Thread Rolf Turner
On 07/11/12 18:35, Erin Hodgess wrote: Dear R People I have a simple list question, please: I have vectors x.1, x.2,...x.n (each of different lengths) and I would like to combine them into a list. However, I'm sure that there is a better way to do this than to type in x <- list(x.1,x.2,x.3,...

[R] a simple list question

2012-11-06 Thread Erin Hodgess
Dear R People I have a simple list question, please: I have vectors x.1, x.2,...x.n (each of different lengths) and I would like to combine them into a list. However, I'm sure that there is a better way to do this than to type in x <- list(x.1,x.2,x.3,...) Is there a better way to do this, ple