Re: [R] Subtract matrices within arrays along indices

2009-07-29 Thread Etienne B. Racine
Hi Christian, Christian Langkamp wrote: > > I have the following array: 3 dimensional object, one dimension being > year. Object is 3*3*3 > > library(plyr, reshape) > # reshape won't be loaded that way, use separate library() Christian Langkamp wrote: > > a1<-rep(c(2007,2008,2009),9) > a2<-c

[R] Subtract matrices within arrays along indices

2009-07-29 Thread Christian Langkamp
I have the following array: 3 dimensional object, one dimension being year. Object is 3*3*3 library(plyr, reshape) a1<-rep(c(2007,2008,2009),9) a2<-c(rep("a",9),rep("b",9),rep("c",9)) a3<-c(rep(c(rep(1,3),rep(2,3),rep(3,3)),3)) a4 <- rnorm(27) A<-data.frame(cbind(comp=a2,val=a3, year=a1, a4)) A1<