Code Publishing Tutorial

Make your code and material available to others

A self-paced tutorial on preparing code and research materials for publication, covering copyright and licensing, documenting data and code, writing a README, and archiving your project.

This tutorial covers how to make your code and material available to others. It wraps up a series of tutorials which we recommend to go through in advance.

Tutorial Overview

This self-paced tutorial is intended to be worked through in order, one section after the other.

The tutorial is split into the following sections:

  1. Introduction motivates why you should publish your code and material.
  2. Project Setup prepares the project folder and the example manuscript used throughout.
  3. Sharing work of others: Copyright explains what you are allowed to share and under which conditions.
  4. Add Data and Data Dictionary adds the underlying data and documents it.
  5. Add Code adds the analysis code and makes the project reproducible.
  6. Choose a License picks an appropriate license for your content and code.
  7. Make a README writes the high-level documentation others need to reuse your project.
  8. Archive Your Project uploads the project to a repository and obtains a DOI.

We will start with creating a simple report which incorporates R code. Then, we will focus on what is required to publish your work:

  • removing legal barriers: adding an appropriate license
  • high-level documentation: creating a README file
  • archival: uploading it to a repository

Prerequisite Tutorials

While the general principles taught in this tutorial apply to most researchers publishing code, we will focus on the programming language R and the publishing system Quarto. You may want to work through the following tutorials in advance:

WarningRecommended Software

This tutorial assumes you have the following software installed:

Some things will be explained using the RStudio IDE, but you are free to use any IDE you like.

Quarto is a tool to render dynamic documents, but not the only one.

It is the successor of the R package rmarkdown and mostly backwards-compatible. rmarkdown continues to be supported, but the development of new features happens in Quarto. The main difference is that Quarto has first-class support for Python. In other words, Python users of Quarto do not need to have R installed.

While this tutorial focuses on Quarto, you can also create dynamic documents with the following tools:

Get started

TipSupport the LMU Open Science Center!

Like this tutorial? Be sure to give the repository a star and follow us on GitHub!

TipQuestions about this tutorial?

If you have questions for the author of this tutorial, please take a look at the About page.

Back to top