Thanks a lot for your hint

marco

2011/5/27 Erich Neuwirth <erich.neuwirth@univie.ac.at>

> > arr<-1:72
> > dim(arr)<-c(2,4,3,3)
> > apply(arr,1:2,sum)
>     [,1] [,2] [,3] [,4]
> [1,]  297  315  333  351
> [2,]  306  324  342  360
> > apply(arr,3:4,sum)
>     [,1] [,2] [,3]
> [1,]   36  228  420
> [2,]  100  292  484
> [3,]  164  356  548
> >
>
> apply(arr,1:2,sum)
> will sum all elements arr(i1,i2,..)
> for each single combination of the first and the second index
> over all possible combinations of the third and fourth index.
>
>
>
>
> On 5/27/2011 12:06 AM, marco milella wrote:
> > Hi to everybody
> > I have an array with dimensions 2,4,3,3.
> > Wanting to sum the matrices in the first two dimensions, I'm trying to
> use
> > the "apply" function, but with no results. Have to say I'm quite new with
> R
> > syntax.
> > tx in advance
> >
> > marco
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
>
>


-- 
Dr. Marco Milella

Anthropologisches Institut & Museum
Universität Zürich-Irchel
Winterthurerstrasse 190
8057 Zürich
Schweiz
e-mail: marco.milella@aim.uzh.ch
phone: +41-44-635-5428
fax:   +41-44-635-6886

	[[alternative HTML version deleted]]

