Making YOUR Code Reproducible: Tips and Tricks

When we were putting together the British Ecological Society’s Guide to Reproducible Code we asked the community to send us their advice on how to make code reproducible. We got a lot of excellent responses and we tried to fit as many as we could into the Guide. Unfortunately, we ran out of space and there were a few that we couldn’t include.

Luckily, we have a blog where we can post all of those tips and tricks so that you don’t miss out. A massive thanks to everyone who contributed their tips and tricks for making code reproducible – we really appreciate it. Without further ado, here’s the advice that we were sent about making code reproducible that we couldn’t squeeze into the Guide:

Organising Code

©Leejiah Dorward

“Don’t overwrite data files. If data files change, create a new file. At the top of an analysis file define paths to all data files (even if they are not read in until later in the script).” – Tim Lucas, University of Oxford

“Keep one copy of all code files, and keep this copy under revision management.” – April Wright, Iowa State University

“Learn how to write simple functions – they save your ctrl c & v keys from getting worn out.” – Bob O’Hara, NTNU

For complex figures, it can make sense to pre-compute the items to be plotted as its own intermediate output data structure. The code to do the calculation then only needs to be adjusted if an analysis changes, while the things to be plotted can be reused any number of times while you tweak how the figure looks.” – Hao Ye, UC San Diego Continue reading

Advertisements

A Guide to Reproducible Code in Ecology and Evolution

Post provided by Natalie Cooper and Pen-Yuan Hsing

Cover image by David J. Bird

The way we do science is changing — data are getting bigger, analyses are getting more complex, and governments, funding agencies and the scientific method itself demand more transparency and accountability in research. One way to deal with these changes is to make our research more reproducible, especially our code.

Although most of us now write code to perform our analyses, it’s often not very reproducible. We’ve all come back to a piece of work we haven’t looked at for a while and had no idea what our code was doing or which of the many “final_analysis” scripts truly was the final analysis! Unfortunately, the number of tools for reproducibility and all the jargon can leave new users feeling overwhelmed, with no idea how to start making their code more reproducible. So, we’ve put together the Guide to Reproducible Code in Ecology and Evolution to help. Continue reading

BES Guide to Reproducible Code: Tips and Tricks Needed

The British Ecological Society is currently working on a Guide to Reproducible Code. This will follow on from our previous Guides to Peer Review, Data Management and Getting Published. All of our Guides are intended to provide Early Career Researchers with a concise and easy to understand introduction to the topic. You can download them for free on our website.

Each Guide includes short pieces of advice provided by academics who are familiar with the topic – and this is where you come in. We’re looking for tips and tricks to help Early Career Researchers looking to make their code reproducible and we would like your help.

We’ve set up a Google form with sections that relate to the broad areas that will be covered in our Guide to Reproducible Code:

  1. Organising Code
  2. Writing Code
  3. Report Writing
  4. Versioning
  5. Archiving Code
  6. Additional Resources

The guide is intended for people who are fairly new to coding, so please don’t be too technical. There are options to enter three pieces of advice in each section (if you’ve got more tips and tricks, feel free to fill in the form multiple times). We’ll choose the best pieces of advice and publish them in the Guide, along with the name and affiliation of the person who provided them.

You can submit your Tips and Tricks for Making Code Reproducible here. Thank you for contributing to our Guide.