pe <- read.csv("pe.csv") pe <- pe[-1537] ts <- ts(pe$P.E.Ratio, start=1881, frequency=12) years <- seq(from=1880, to=2005, by=5) averages <- sapply(years, function(x) mean(window(ts, x, x+5))) devSVGTips("peratio.svg", height=4, width=6) barplot(averages, names.arg=years, main="PE Ratios") dev.off() clickableSVG("peratio.svg", clickable.element="rect", values=averages, update="mean", text.x=60, text.y=60)