A Minimal Example

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

library(reproducibleRchunks)

Setup

First, load the reproducibleRchunks package in the first code chunk. Once the package is loaded, the code chunk type reproducibleR is now available. Your first code chunk will probably look like this:

```r
library(reproducibleRchunks)
```

Using reproducible code chunks

Now, you can use reproducibleR chunks like you use normal R code chunks. For example, let us define some data and run a simple statistical model in the following code chunk:

```r
x <- 1:6
y <- c(4, 8, 15, 16, 23, 42 )

model <- lm(y~x)
```
x <- 1:6
y <- c(4, 8, 15, 16, 23, 42 )

model <- lm(y~x)

The reproducibleRchunks package will store meta-data about all variables that are newly declared within a given chunk. Every time, the document is regenerated and metadata are present, reproducibleR will compare the original data and the regenerated data and will display information about whether they match or not.



Try the reproducibleRchunks package in your browser

Any scripts or data that you put into this service are public.

reproducibleRchunks documentation built on Aug. 8, 2025, 6:38 p.m.