Skip to content

Commit af45b1f

Browse files
committed
reproducibility summer 2025
1 parent 8dee49b commit af45b1f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

modules/Reproducibility/Reproducibility.Rmd

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
---
2+
title: "Reproducibility"
3+
output:
4+
ioslides_presentation:
5+
css: ../../docs/styles.css
6+
widescreen: yes
7+
---
8+
19
```{r include=FALSE}
210
knitr::opts_chunk$set(echo = FALSE, message = FALSE, comment=FALSE, warning=FALSE)
311
```
@@ -13,6 +21,7 @@ library(devtools)
1321
library(remotes)
1422
install.packages("ottrpal", repos = "https://cloud.r-project.org", quiet = TRUE)
1523
library(ottrpal)
24+
library(patchwork)
1625
```
1726

1827
## What's Reproducibility
@@ -173,6 +182,28 @@ sample(10)
173182

174183
Note that these are only pseudo random and the values are created doing calculations based on the given seed. Thus the same "random" values will be reproduced by everyone using the same seed with `set.seed`.
175184

185+
## `set.seed()` visualization {.smaller}
186+
187+
```{r, echo = TRUE, fig.height=3}
188+
Aset <- data.frame(x = rnorm(100)) # no seed
189+
Bset <- data.frame(x = rnorm(100)) # no seed
190+
set.seed(111); Cset <- data.frame(x = rnorm(100)) # set seed = 111
191+
set.seed(111); Dset <- data.frame(x = rnorm(100)) # set seed = 111
192+
randomA <- ggplot(Aset) + geom_histogram(aes(x = x)) + ggtitle("no seed")
193+
randomB <- ggplot(Bset) + geom_histogram(aes(x = x)) + ggtitle("no seed")
194+
randomC <- ggplot(Cset) + geom_histogram(aes(x = x)) + ggtitle("seed = 111")
195+
randomD <- ggplot(Dset) + geom_histogram(aes(x = x)) + ggtitle("seed = 111")
196+
randomA + randomB + randomC + randomD + plot_layout(ncol = 4) # combine plots with patchwork
197+
```
198+
199+
## Very helpful for bootstrapping
200+
201+
```{r, fig.alt="Rsample", out.width = "10%", echo = FALSE, fig.align='center'}
202+
knitr::include_graphics("images/Rsample.png")
203+
```
204+
205+
https://rsample.tidymodels.org/reference/bootstraps.html
206+
176207
## R Markdown syntax
177208

178209
Before:
22.2 KB
Loading

0 commit comments

Comments
 (0)