nad,

The line that does the averaging is:

`if (!is.null(wfl)) x <- filter(x,rep(1,wfl)/wfl)`

filter is a built-in R function to do weighted smoothing; here the weights are uniform (1/wfl, wfl=12) over a 12-month window.

The line that does the differencing is:

`diff12[m,] <- diff(x[ii])`

diff is another built-in R function.

The wiggles in the green curve from Fig. 2 don't surprise me given the CO2 curve in Fig. 1. The differencing pulls out all the interannual variability in the carbon cycle, which isn't nice and symmetric. (See also [Renato Iturriaga's graphs](http://johncarlosbaez.wordpress.com/2011/02/04/carbon-dioxide-puzzles/), annually averaged.) But there may be more going on than what I described. I don't quite understand why the R code is iterating through months, whether it just has to do with how the data is formatted or if it's actually part of the analysis. I'd either have to pore through it in more detail or read the paper to understand what they're trying to do.