[R] Creating a list by just using start and final component
Romain Francois
romain.francois at dbmail.com
Sun May 24 11:07:56 CEST 2009
Hollix wrote:
> Hi there,
>
> say, I have 100 matrices (m1,m2,...,m100) which I want to combine in a list.
> The list, thus, shall contain the matrices as components.
>
> Is it necessary to mention all 100 matrices in the list() command? I would
> like to use just the first and last matrix or something similar.
>
> Best,
> Holger
>
Hi,
you can do something like that:
matrices <- ls( pattern = "m[0-9]+" )
res <- lapply( matrices, get )
Romain
--
Romain Francois
Independent R Consultant
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
More information about the R-help
mailing list