A result is reproducible when the same analysis steps performed on the same dataset consistently produces the same answer. (The Turing Way Community, 2022)
Image: Scriberia for The Turing Way community (CC-BY). https://doi.org/10.5281/zenodo.3332808.
See also: Five selfish reasons to work reproducibly (Markowetz, 2015)
🗄️ The data
📰 The code
🧾 The analysis workflow
💻 The dependencies to run the code on the data (operating system, software, packages, etc.)
💬 Documentation, documentation, documentation
A study may be more or less reproducible than another depending on what data and code are made available (Peng, 2011).
Project templates: UtrechtUniversity/simple-r-project (R), UtrechtUniversity/simple-python-template (Python)
&
%
$
#
/
,
+
), spaces or dots (.
)-
or _
Images: OSF’s File naming Guide
Documentation provides context for your work. It allows your collaborators, colleagues and future you to understand what has been done and why. (The Turing Way Community, 2022)
For example:
Project documentation (project proposal, analysis log, README file, etc.)
Data documentation (e.g., codebook)
Code documentation (e.g., comments, requirements.txt)
See Utrecht University’s FAIR code cheatsheet and https://www.makeareadme.com/
Code is for computer, comments are for humans.
Consistency will make your code easier to understand and maintain
Python | R | |
---|---|---|
Style Manual | Pep-8 | Tidyverse style guide |
Linters | flake8, pylint | lintr |
Formatters | black | styler |
Do One Thing (and do it well)
Identify potential functions by action: functions perform tasks (e.g. sorting, plotting, saving a file, transform data…)
If you copy-paste a piece of code, it is often a good candidate for a function
Separate code and data: data is specific, code need not be
gravity = 9.80665
, once.Distributed Version Control system written by Linus Torvalds
Allows you to:
Current standard for code
GitHub is an online platform for hosting your coding projects
Based on git
Social coding platform: share, collaborate, and contribute to projects
The UU has an institutional GitHub
Add a license to your project
Specify how people should cite your code
Publish your GitHub code on Zenodo to get a DOI
RDM Support UU:
Intro to Computational Reproducibility
Comments
Comments: annotations in your code that explain what your code does (to others, and your future self)
No replacement for clear and structured code
May be used to generate user documentation (if in specific format)
In Python & R, use
#
:Image source: Geek & Poke