Hi Stefano, If I understand your request, this may also help, Uses the same data transformations as my previous email.
png("SS_foehn.png") plot(mydf$data_POSIX, ifelse(mydf$main_dir %in% c("WSW","SW"),mydf$max_speed,NA), type="b",main="Wind speed (WSW or SW) by time", xlab="Time of day",ylab="Wind speed km/h", col=rainbow(16)[as.numeric(mydf$main_dir)]) abline(h=8,col="orange",lwd=2) source("../rollmean.R") rmws<-rollmean(mydf$max_speed,4) lines(mydf$data_POSIX,rmws,col="orange",lwd=2) legend("topleft","Rolling mean of 4 for wind speed", lty=1,lwd=2,col="orange") dev.off() Jim
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.