Statistics scripts for R