Flowing Data: R tutorial

This is a very cool intro to the power of R. It may come in handy…

http://flowingdata.com/2013/11/26/the-baseline/

02-Percent change monthly

This is noisy though. Maybe a year-over-year change would be more useful.

1 curr <- gas$Value[-(1:12)]
2 prev <- gas$Value[1:(length(gas$Value)-12)]
3 annChange <- 100 * round( (curr-prev) / prev, 2 )
4 barCols <- sapply(annChange,
5     function(x) {
6         if (x < 0) {
7             return("#2cbd25")
8         else {
9             return("gray")
10         }
11     })
12 barplot(annChange, border=NA, space=0, las=1, col=barCols, main="% change, annual")

The magnitude of drops in price are more visible this way.