Felipe Carrillo <mazatlanmexico <at> 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)

______________________________________________
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.

Reply via email to