knitr utility to convert your static code chunks into an R editor where people can experiment. Powered by DataCamp Light, a lightweight version of DataCamp’s learning interface.

Installing the package

Latest released version from CRAN

Latest development version from GitHub:

Getting started

Add the following chunk at the top of your R Markdown document

Knit your document: in RStudio, simply hit “Knit HTML”, or use

rmarkdown::render("path_to_my_file", output_format = "html_document")

How it works

R vignettes, blog posts and teaching material are typically standard web pages generated with R markdown. DataCamp has developed a framework to make this static content interactive: R code chunks are converted into an R-session backed editor so readers can experiment.

Fiddles

If you render an R Markdown document like this:

An HTML file results that features an in-browser R editor with a session attached to it, where you can experiment.

html_file

Notice that the option self_contained: false is used. That way, always the latest version of the DataCamp Light JS library is fetched when the document is opened. If self_contained: true, the version of the JS library at ‘knit time’ is baked into the HTML document. This can cause backwards compatibility issues.

Other Documentation

  • Tutorial Basics Vignette: explanation on how to convert your static R code chunks into interactive fiddles or exercises, where you can also experiment with DataCamp Light itself.
  • R Markdown and knitr for dynamic documents with R.
  • DataCamp Light JS library
  • Course creation for DataCamp. The documentation includes information on how to get started with course creation, what the different components of an exercise are, how you can write Submission Correctness Tests (SCTs) etc.

For more details, questions and suggestions, you can contact content-engineering@datacamp.com.