March 2018
Beginner to intermediate
570 pages
13h 42m
English
Put any code that is not one-off, and is meant to be run again, in a script. Even for one-off code, you are better off putting it in a script, because (a) you may be wrong (and often are) about not needing to run it again, (b) it provides a record of what you've done (including, perhaps, unnoticed bugs), and (c) you may want to use similar code at another time.
Scripting enhances reproducibility, because now, the only things we need to reproduce in this line of inquiry on another computer are the script and the data file. If we didn't place all this code in a script, we would have had to copy and paste our interactive R console history, which is ugly and messy to say the absolute least.
It's time to come clean ...