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
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
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:
; "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
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
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
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,...
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
8 matches
Mail list logo