Hi Carol,

> m1 <- rbind(c(1,2),c(3,4),c(5,6))
> m2 <- rbind(c(1,2),c(5,6))
> mylist <- list(m1)
> c(mylist, list(m2))
[[1]]
     [,1] [,2]
[1,]    1    2
[2,]    3    4
[3,]    5    6

[[2]]
     [,1] [,2]
[1,]    1    2
[2,]    5    6

See the examples in ?c for more information.

Sarah

On Thu, May 10, 2012 at 2:35 PM, carol white <wht_...@yahoo.com> wrote:
> Hi,
> It might be a trivial question but how do you store matrices of different 
> dimensions read from a file or in a loop together? The best solution might be 
> a list but I don't store the first matrix  correctly:
>
>  m = rbind(c(1,2),c(3,4),c(5,6))
> t=rbind(c(1,2),c(5,6))
>
>
>  l = list(m)
>> l = list(l,t)    #I assumed that at the begining I don't have m and t at the 
>> same time to do list(m,t), but I list them, one after the other
>> l
> [[1]]
> [[1]][[1]]
>      [,1] [,2]
> [1,]    1    2
> [2,]    3    4
> [3,]    5    6
>
>
> [[2]]
>   [,1] [,2]
> t    1    2
>      5    6
>
>
> thanks
>
> Carol
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to