defining an array with one of the elements being a vector

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

defining an array with one of the elements being a vector

cassie jones
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]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: defining an array with one of the elements being a vector

jannis-2
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]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.