Reproducibility

Random seeds

To enable others to fully reproduce your results, you may need to provide a random seed. The random seed is something computers use to generate random numbers. They start from a starting seed, set with set.seed(), and every time they generate a random number they increase the seed by 1.

rnorm(5)
[1] -0.5097482  1.2844200  0.7247886 -1.0126654  0.2439407
rnorm(5)
[1]  0.1930455 -1.2105083 -0.4698737 -0.8749503  1.1362816
set.seed(44)
rnorm(5)
[1]  0.65391826  0.01905227 -1.84950398 -0.13276331 -1.19881818
set.seed(44)
rnorm(5)
[1]  0.65391826  0.01905227 -1.84950398 -0.13276331 -1.19881818

Many analytical methods (e.g. bootstrapping) will require random sampling. If you specify the random seed at the beginning of your document, then each time you compile it, it will produce the same results. Furthermore, if you send the RMarkdown file to someone else, they will be able to get the exact same results too!

---
title: "this is my title"
author: "I am the author"
date: "13/08/2021"
output: html_document
---
```{r setup, include = FALSE}
library(tidyverse)
library(palmerpenguins)
somedata <- read_csv(“https://edin.ac/2wJgYwL”)
set.seed(942) #set random seed
```

Making data and .rmd available on OSF

You may want to make your data and your RMarkdown document available on the Open Science Framework (OSF). We will not go into the details of this here, but we strongly encourage you to be transparent and provide reproducible documents where possible in your work, and OSF is a good way to do this.

You can find some FAQs about the Open Science Framework here: https://help.osf.io/hc/en-us/articles/360019737894-FAQs