Format the Code (Style & Execution)
Programming computers to do cool science is a major advantage for modern scientists. But, developing research programs that are transparent, collaborative and reproducible is a major advantage for science. All data scientists can contribute to this goal by writing their code in easily readable, well described, and well commented scripts.
This script, which evaluates the number of diary entries made over time by treatment and control households in a solar stove field experiment that I ran, doesn’t follow good style. It works, but it’s difficult to understand exactly what it is doing.
- Download the script
- Download the data
- Take a minute to try understand what is going on (you won’t perfectly because you are unfamiliar with many of the commands)
- Modify the code so that it still does the same thing, but is easier to read because it has better style