[R] aggregate and stack

From: Paulo Brando <pmbrando_at_ipam.org.br>
Date: Thu 26 May 2005 - 11:01:32 EST

Dear All,

I have tried to calculate tree mean growth but I think the structure I used below (growthresumo) is not the most elegant, even though it worked. The only problem I had in this first part was that I cannot use 'summary', just 'mean' (sorry but 'R' is pretty new for me).

>growthresumo <- aggregate(growth[,c(16,19,23,27,31,35,39,43,47,52,56,60,64,68,72,76,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,
141,145,149,153,157,161,165,169,173,177,181,185,189,194,197,201,205,209,213,217,221,225,229,233,237,241)], by=(growth[,c(3,8)]),MEAN,na.rm=TRUE)

#after growth is calculated, I want to stack the results in just one colunm.

>growthvertical <- c(growthresumo[,3],...,growthresumo[,50]) # this is very time consuming though

>Parcel <- c("C9","S8"..."C9","S8") # 50 items

>date < c("DATE1"...."DATE50")

>growthpermonth <- data.frame(Parcel, Date, growthvertical)

Thank you very much!


Paulo Brando
Inst. de Pesquisa Ambiental da Amazônia (IPAM) Rua Rui Barbosa,136.
68.005.080 Santarém, PA, Brasil.
Fone/Fax ++ 55 93 522 5538

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu May 26 08:10:07 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:06 EST