cassie jones
2011-Mar-08 22:23 UTC
[R] defining an array with one of the elements being a vector
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]]
Jannis
2011-Mar-08 22:57 UTC
[R] defining an array with one of the elements being a vector
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. >