When programming in Stata I often find myself using the loop index in the programming. For example, I\'ll loop over a list of the variables nominalprice and realprice:
Using ggplot2 and reshape:
library(ggplot2) library(reshape) df <- data.frame(nominalprice=rexp(10), time=1:10) df <- transform(df, realprice=nominalprice*runif(10,.9,1.1)) dfm <- melt(df, id.var=c("time")) qplot(time, value, facets=~variable, data=dfm)