Formatted R scripts for @jalperin's review