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)
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()
# 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)
with(mycars, plot(mpg, hp))
ggplot(mycars, aes(mpg, hp)) + geom_point() + theme_minimal() + NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.