This image was created by Scriberia for The Turing Way community and is used under a CC-BY licence. DOI 10.5281/zenodo.3332807.
Colleagues in your research group, reviewers, and scholarly peers will all need to know how to use your code. Another huge incentive to document your code is that, between teaching, learning, shifting your focus from one project to another, and other distractions of living life and existing in academia, you may need some reminders yourself. As the data scientist Garret Christensen advises in a piece in the edited volume The Practice of Reproducible Research:
"Comment the hell out of your code so you know what you were doing when a journal makes a decision about your submission after six months."
Below, we suggest a few methods for documentation. The level of documentation your project requires may vary. For a simple script that produces figures for a paper that you or a reviewer may wish to validate, you need to provide installation instructions, but you probably don't need to create a full-on tutorial. For a more complex project, making a Jupyter Notebook or R Notebook that combines code with notes and observations might be helpful.