>>>>> baptiste auguie <baptiste.aug...@googlemail.com>
>>>>>     on Fri, 20 Apr 2012 09:01:35 +1200 writes:

    > library(plyr) 
    > adply(my.array,1:3)

Hmm,  as Marc Schwartz has already said:  
There's the base R   as.data.frame() method for "table" objects 
which also works for arrays, so

      as.data.frame(as.table(my.array))

works as well as  Marc's

      as.data.frame.table(my.array)

Do we need better ways to find this?
Martin


    > HTH,

    > baptiste

    > On 20 April 2012 08:46, Emmanuel Levy
    > <emmanuel.l...@gmail.com> wrote:
    >> Hi,
    >> 
    >> I have a three dimensional array, e.g.,
    >> 
    >> my.array = array(0, dim=c(2,3,4), dimnames=list(
    >> d1=c("A1","A2"), d2=c("B1","B2","B3"),
    >> d3=c("C1","C2","C3","C4")) )
    >> 
    >> what I would like to get is then a dataframe:
    >> 
    >> d1 d2 d3  value A1 B1 C1 0 A2 B1 C1 0 .  .  .  A2 B3 C4 0
    >> 
    >> I'm sure there is one function to do this transformation,
    >> I just don't know which one.
    >> 
    >> Thanks for your help,
    >> 
    >> Emmanuel

______________________________________________
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