Analysis computer code

Last updated on 2024-11-19 | Edit this page

Estimated time: 51 minutes

Overview

Questions

  • How do I include analysis computer code in my publication package in such a way that is understandable for others?

Objectives

  • Include computer code describing the analysis data into the results reported in the manuscript in your publication package
  • Consider using tools such as Quarto, R Markdown, or Jupyter notebooks to share code and narrative text in one document
Include code describing the steps taken to process the analysis data into the results reported in the manuscript, including brief explanations of the steps in English
Infographic snippet: Include code describing the steps taken to process the analysis data into the results reported in the manuscript, including brief explanations of the steps in English

Steps to take

  • You should include computer code (for example syntax files from SPSS/JASP, Atlas.ti, Matlab, R; syntaxes of tailored software) describing the steps taken to process the analysis data into results in the manuscript. This should include brief explanations of the steps in English.
  • Just as with the preprocessing computer code, for the analysis code it is very helpful to use tools like Quarto, R markdown, or Jupyter notebooks.
  • Again, it is highly recommended to have your preprocessing and analysis code checked for reproducibility by others, or at the least check guidelines from initiatives such as ReproHack or CODECHECK. Keep in mind that documentation of your code is key!

Example files

See the analysis_safi.qmd and analysis_safi.html file in the scripts folder from the EUR publication package example repository on Zenodo. The .qmd file is a Quarto markdown document, in which R code and documentation are combined. It produces a readable html file that can also be included in the publication package. See the html file below:

Figure: Rendered html file for the preprocessing code from the EUR publication package example

Other examples you can think of:

Code exercise

Share a copy of your analysis computer code or syntax with a colleague or with your neighbor during the workshop.

  • Can they open the file without the need for any specialized software?

  • Is it clear to them what is needed to analyze the data?

  • Bonus question: are they able to rerun your analysis independently?

  • Which improvements do they suggest to make the data file as clear as possible?

Key Points

  • Include materials, data and code that is needed to reproduce or replicate your research in the publication package
  • Describe data and code clearly, to make sure that everything is self-explanatory
  • Save the files using clear file names and in sustainable file formats