Getting a DOI for your code

[This article was first published on R – scottishsnow, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Academics have published work for centuries. Over the past couple of decades the type of work academics do has been changing. Our output is no longer constrained to peer reviewed articles, but includes reports, data, code, infographics, book chapters and many more. Some of these outputs are easy to share, but we also need to be able to demonstrate where they’ve come from: to help science be reproducible and as a measure of our own work.

This blog article is an explanation of sharing research code. It focuses on using the version control website Github and academic repository Zenodo. Github uses Git to help manage your code development and collaborate with others, you can learn more about using it in this article from Jenny Bryan. Zenodo is a repository hosted at Cern, it is a way of getting a digital object identifier (DOI) for your work. A DOI is a persistent handle standardised by the ISO, in short it is a link which will always end up in the right place.

Once you have code in Github (help yourself and attend a software/data carpentry course), then you are ready to link Zenodo to Github.

  1. Sign into Zenodo, you can use your Github credentials.
  2. In your account settings you can link Github to Zenodo.
  3. Choose the Github repository you want to link and follow the instructions at the top of the Zenodo page about Github releases.
  4. Fill in your metadata on Zenodo.

You can add a json file to your Github repo which Zenodo will use to populate metadata, if you don’t do this Zenodo will overwrite your metadata each time your make a new release. Thankfully you have made a template of this json file.

  1. Back in your Zenodo Github settings click on the enabled repository.
  2. Click on a release (green text)
  3. Copy json metadata into a .zenodo.json file in your Github repo, this will be used to populate metadata on your next release.

You can view the output of this process here, which includes the metadata json: Michael Spencer. (2019, September 3). Hill farming study – analysis code (Version v1.02). Zenodo.

To leave a comment for the author, please follow the link and comment on their blog: R – scottishsnow. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)