inst/snippet/law-large-numbers.R

x <- rexp(1000)
runningMean <- cumsum(x) / 1:length(x)
expPlot <- 
    xyplot(runningMean~1:1000,ylab="running mean", xlab="n",type="l",
        panel=function(...){ panel.abline(h=1,col='gray70');
            panel.xyplot(...); });

Try the fastR package in your browser

Any scripts or data that you put into this service are public.

fastR documentation built on May 1, 2019, 11:18 p.m.