[R] Data in Array

jim holtman jholtman at gmail.com
Tue Sep 8 16:45:09 CEST 2009


Not sure what you mean by 'store', but you can use a list:

> a <- matrix(1, nrow = 5, ncol = 1)
> b <- matrix(2, nrow = 10, ncol = 1)
> c <- matrix(3, nrow = 15, ncol = 1)
> myList <- list(a, b, c)
> str(myList)
List of 3
 $ : num [1:5, 1] 1 1 1 1 1
 $ : num [1:10, 1] 2 2 2 2 2 2 2 2 2 2
 $ : num [1:15, 1] 3 3 3 3 3 3 3 3 3 3 ...
> myList[[2]]
      [,1]
 [1,]    2
 [2,]    2
 [3,]    2
 [4,]    2
 [5,]    2
 [6,]    2
 [7,]    2
 [8,]    2
 [9,]    2
[10,]    2
>
>


On Tue, Sep 8, 2009 at 8:14 AM, FMH<kagba2006 at yahoo.com> wrote:
> Yes, but what actually i want to have is an array that might store these different matrices.
>
>
>
> ----- Original Message ----
> From: Schalk Heunis <schalk.heunis at enerweb.co.za>
> To: FMH <kagba2006 at yahoo.com>
> Cc: r-help at r-project.org
> Sent: Tuesday, September 8, 2009 11:16:29 AM
> Subject: Re: [R] Data in Array
>
> have you tried rbind?
>
>
> On Tue, Sep 8, 2009 at 11:16 AM, FMH<kagba2006 at yahoo.com> wrote:
>> Dear All,
>>
>> I have some data which were stored in few  matrices with different orders. Let have three different matrices a, b and c, which have the same number of column but different number of row.
>>
>>
>> a <- matrix(1, nrow = 5, ncol = 1)
>> b <- matrix(2, nrow = 10, ncol = 1)
>> c <- matrix(3, nrow = 15, ncol = 1)
>>
>> How could i put all these matrices in an array?
>>
>> Thank you
>> Kagba
>>
>>
>>
>>
>> ______________________________________________
>> R-help at 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.
>>
>
>
>
>
>
> ______________________________________________
> R-help at 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list