Re: [R] Loop through a simulation

2013-05-16 Thread arun
HI, Try this: dat1- read.csv(data2.csv,header=FALSE,sep=\t)   dim(dat1) #[1] 345156  5 res- aggregate(V5~V2+V3+V4,data=dat1,FUN=mean)  dim(res) #[1] 16436 4  head(res) #    V2 V3 V4 V5 #1 1961  1  1 0.51761905 #2 1962  1  1 0.0467 #3 1963  1  1 1.14761905 #4 1964  1  1

Re: [R] Loop through a simulation

2013-05-16 Thread arun
Hi, May be this is what you meant. dat1- read.csv(data2.csv,header=FALSE,sep=\t) library(plyr) res1- ddply(dat1,.(V2,V3,V4),summarize,V5=round(mean(V5),2))  head(res1) #    V2 V3 V4   V5 #1 1961  1  1 0.52 #2 1961  1  2 0.00 #3 1961  1  3 0.00 #4 1961  1  4 0.00 #5 1961  1  5 0.12 #6 1961  1  6

Re: [R] Loop through a simulation

2013-05-16 Thread Zilefac, Elvis
Thanks AK. It works as expected. Atem. From: arun [smartpink...@yahoo.com] Sent: Thursday, May 16, 2013 11:16 AM To: Zilefac, Elvis Cc: R help Subject: Re: Loop through a simulation Hi, May be this is what you meant. dat1-