I have code that is designed to produce multiple output jpeg plots of time series decomposition (in for each hour of the day). I run the code and I do not receive and error. In fact, I receive some indication that the outputs were produced.
Here is the function that was created (given to me from an expert on stackoverflow):
HR.plot <- function(y,z){
ARMAXpath<-file.path("C:", "Desktop","RPLOTS", paste0("HRplot_", z, ".jpg"))
jpeg(file = ARMAXpath)
plot(stl(y,s.window="periodic"))
dev.off()
}
I use this code in a by() statement:
by(Dataset, Dataset$Hour, function(d) HR.plot(Dataset$UQ,unique(Dataset$Hour)))
It returns 1 chart, the very first Hour level and no more. My question: How can I change the code to get it to produce output plots for eah hour of the day (hour variable)? I posted a similar question a couple of hours earlier with totally different code and I could not get that code to work, because of issues loading ggplot2 Thank you
注意,在函数调用中使用unique(Dataset$Hour)
而不是d
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.