[R] defining an array with one of the elements being a vector

Jannis bt_jannis at yahoo.de
Tue Mar 8 23:57:17 CET 2011


Cassie,


why do you think that the code you want to run does not work? Running 
your code gives me an array with 6 dimensions and no errors. Do you use 
an old R version (I vaguely remember that something regarding arrays 
changed in R some time ago, i could be mistaken though...)? Do you want 
to create an array with different dimensions?

Jannis


P.S. Please post a version of your code and the errors you get!

On 03/08/2011 11:23 PM, cassie jones wrote:
> Dear all,
>
>
> I am trying to define an array as follows:
>
> a=array(NA,c(m,2,N,G)),
>
> Even though the numbers N and G are fixed, m is a vector. So, I can't define
> 'a' as above.
>
>   For eg,
>
> N=3
> G=6,
> but m=c(2,7,5) and length(m)=N.
>
>
> Can anyone suggest me how can I define 'a' when m is a vector?
>
>
> Thanks in advance for your help.
>
>
> Cassie
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list