[R] cbind and mean by week

From: Felipe Carrillo <mazatlanmexico_at_yahoo.com>
Date: Tue, 25 Mar 2008 20:18:56 -0700 (PDT)


 Hi:
 I have been able to finally crunch my data by importing it by week(thank you all for your help),but here we go again..
 Now I'am trying to do it for the the whole year. Since the
 dataset is huge I'm only making a 3 weeks dataframe.
- I want to get the mean of pd by week

week<-c(28,28,28,28,28,28,28,29,29,29,29,29,29,29,30,30,30,30,30,30,30)

td<-c(0.015,0.012,NA,0.015,NA,0.014,0.014,0.013,0.013,0.013,0.013,NA,0.010,0.013,0.015,0.011,0.014,0.014,0.014,0.014,0.016)
pd<-c(0,0,NA,80,NA,45,223,228,224,488,525,NA,80,417,413,373,914,213,651,521,979)
 x<-data.frame(week,td,pd)

 x
  pmean<- tapply(x[,3], x$week, mean)
    pdmean
    pdmean<- data.frame(pmean)
    pdmean
 xweek <- aggregate(x, list(x$week), mean) xweek

 Felipe D. Carrillo
  Fishery Biologist
  Department of the Interior
  US Fish & Wildlife Service
  California, USA



Be a better friend, newshound, and

R-help_at_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. Received on Wed 26 Mar 2008 - 03:22:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Mar 2008 - 11:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive