Skip to content
Filip Schouwenaars edited this page May 31, 2016 · 1 revision

Tutorial

The tutorial package by DataCamp is a wrapper around knitr that is able to convert your static code chunks into a R/Python editor where people can experiment. This is done with the help of DataCamp Light, a JavaScript library that converts HTML chunks with the proper formatting into iframes that house an interactive R or Python session.

To get you started with the different ways to use tutorial, you can read the Tutorial Basics Vignette. The rest of this wiki is devoted to specific questions users had.

FAQ

Do pages built with the tutorial package always establish a connection to datacamp.com?

Yes. The tutorial package depends on DataCamp Light. This is a JavaScript library that, as the name suggests, acts as a light version of the DataCamp learning interface (which you can experiment with here, make sure you're logged in). DataCamp Light creates an actual R or Python session where you can execute code, and experiment. All R packages that are on CRAN are available on DataCamp's R servers.

Is the testwhat package used by tutorial? If so, how does the fact that it requires proprietary R packages limit our use of tutorial in our own work?

You can use the tutorial package to create simple 'experiment with the code' problems, where you only specify the sample-code element. If you in addition specify the solution and sct chunks, the DataCamp Light window is converted into an actual DataCamp coding challenge. For R exercises, the DataCamp R servers will load the testwhat package by default, enabling you to use its functions in the SCT (Submission Correctness Test).

This should by no means limit your use of the tutorial package. If you don't use it in a coding challenge context, there's no submission testing, so no usage of testwhat whatsoever.

Is there a way to get RStudio to use the tutorial package when knitting?

This is something that we haven't figured out yet. For now, you'll have to use tutorial::render("my_file.Rmd").

How do I share my DataCamp Light powered documents?

You can add the required chunks and snippets in the .Rmd file, render it using tutorial::render() and then send along the resulting HTML file. Alternatively, you can send along the original .Rmd file, have them install tutorial and render the markdown file themselves.

Clone this wiki locally