knitr::opts_chunk$set(echo = TRUE)

library(repro)
# load packages from yaml header
automate_load_packages()
# include external scripts
automate_load_scripts()
# load data 'mycars' (ok it is mtcars...)
mycars <- automate_load_data(mycars, read.csv, stringsAsFactors = FALSE)

Repro Package

May I suggest to run repro::automate() now? This will create a Dockerfile & Makefile based on every RMarkdown file in this folder. The meta information that are provided in each RMarkdown (remember there are special yaml headers for repro) will be evaluted and adjustments will be made accordingly.

If you are unsure whether or not you have git make & docker on your system, try running this in your R console:

check_git()
check_make()
check_docker()

Analysis

# see R/clean.R
# this chunk (as long as it is empty, comments don't count) runs external
# code from scripts listed in the YAML
# see also https://yihui.org/knitr/demo/externalization/
summary(mycars$mpg)

Including Plots

with(mycars, plot(mpg, hp))

Including Fancy Plots

ggplot(mycars, aes(mpg, hp)) +
  geom_point() +
  theme_minimal() +
  NULL


aaronpeikert/repro documentation built on Sept. 16, 2024, 7:12 p.m.