thx guys, this is what i came up with. it works fine, but too many lines of code.
thanks again. Cameron \pagebreak \section{General Value Graph Daily} \setkeys{Gin}{width=1.1\textwidth} <<results=tex,echo=FALSE>>= rng=range(time(pf4[[1]])) Syr <- as.numeric(format(rng[1],"%Y")) Eyr <- as.numeric(format(rng[2],"%Y")) Smth <- as.numeric(format(rng[1],"%m")) for( yr in Syr:Eyr){ file1=paste("myfile", yr, sep="") Temp1 <- pf4[[1]][which(format(time(pf4[[1]]),"%Y")==yr),] Temp3 <- tapply(Temp1[,1],as.yearmon(time(Temp1)),FUN=mean) cat("\\begin{figure}[!htbp]\n") cat("\\begin{center}\n") pdf(file=paste(file1,".pdf",sep="")) par(mfrow=c(4,3),mar=c(3,2,2,2)) for(i in Smth:length(Temp3)){ i <- ifelse(i < 10, paste(0,i,sep=""),i) Date <- paste(i,yr,sep="-") Temp2 <- pf4[[1]][which(format(time(pf4[[1]]),"%m-%Y")==Date),] plot(Temp2[,"Day"],Temp2[,"Daily Value"]/1000000,type="l",main=paste(factor(as.numeric(i), labels = month.name[as.numeric(i)]),yr,sep="-")) } dev.off() cat("\\includegraphics{", file1, "}\n", sep="") cat("\\end{center}\n") cat("\\caption{Volume Graph Analysis Daily ",yr,", x = business day, y = in million}\n",sep="") cat("\\label{fig3}\n") cat("\\end{figure}\n\n") } @ -- View this message in context: http://r.789695.n4.nabble.com/Sweave-Dynamic-Graph-Question-tp3051003p3055407.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.