Skip to content

Instantly share code, notes, and snippets.

View whitead's full-sized avatar
:atom:

Andrew White whitead

:atom:
View GitHub Profile
@whitead
whitead / moving_average
Last active December 26, 2015 20:39
Moving average with ghosted lines
plot_ma <- function(d, start_lwd=0.9, start_gray=0.5, ...) {
if(!is.data.frame(d))
d <- as.data.frame(d)
iter <- as.integer(floor(log(nrow(d), base=10)))
dlwd <- (1.5 - start_lwd) / iter
dgray <- (0.9 - start_gray) / iter
pargs <- substitute(...)