Exactly what I want, thanks a lot Ben. Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA
----- Original Message ---- > From: Ben Bolker <bol...@ufl.edu> > To: r-h...@stat.math.ethz.ch > Sent: Tue, May 11, 2010 12:11:00 PM > Subject: Re: [R] predicting without a model > > Felipe Carrillo <mazatlanmexico <at> > href="http://yahoo.com">yahoo.com> > writes: ## snip > In the absence of any other information, I would say your best bet would just > be to take the weekly average across the previous years. There are lots > of ways to do this (tapply, aggregate, etc.), but cast() > works: fallavg <- > cast(fallmelt,value="value",WEEK~.,fun.aggregate=mean, > na.rm=TRUE) names(fallavg)[2] <- > "value" fallavg$variable <- > "predicted" ggplot(fallmelt,aes(WEEK,value/1000,linetype=variable, > > colour=variable,fill=variable)) + geom_line(size=1)+ > theme_bw() + scale_x_continuous(breaks=seq(1,52,3), > > labels=levels(fall$week)[seq(1,52,3)],) + opts(title="Fall > Cumulative") + labs(y="Number of fish X 1,000",x="WEEK")+ > geom_line(data=fallavg,size=2) ______________________________________________ > ymailto="mailto:R-help@r-project.org" > href="mailto:R-help@r-project.org">R-help@r-project.org mailing list > href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank > >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. ______________________________________________ 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.