About this package
tutorial.helpers provides functions to help you write R tutorials, especially if you follow my advice about the best way to do so.
Installation
To install the package from CRAN:
install.packages("tutorial.helpers")You can install the development version from GitHub with:
remotes::install_github("PPBDS/tutorial.helpers")Useful tools
Creating a tutorial
To create a new tutorial, you first need a new directory, located in the inst/tutorials directory of your package. Create a tutorial.Rmd file within it. The AI vignette provides a highly opinionated framework for teaching students how to use AI to do data science, including the required info_section and download-answers chunks which every tutorial should contain.
Testing
The package includes two important functions: make_exercise() and check_current_tutorial(). Use make_exercise() to add a new exercise to the current tutorial. It will number the exercise, and the code chunk labels, automatically. Use check_current_tutorial() to renumber all the exercises and relabel all the code chunks. This is especially useful if you add or delete an exercise in the middle of a section.
There are three exported functions for checking the tutorials in your package. See the testing vignette for details on their use.
Tutorials
The package includes the “Getting Started” tutorial, which uses VS Code on GitHub Codespaces. You should require your students to complete it if you are creating your own tutorials with the tutorial.helpers package. Have students run:
This will teach them enough about how tutorials work to be able to complete the tutorials you write.
Download answers
The most useful tool is the download answers trick. In your tutorial, simply include library(tutorial.helpers) in the setup R code chunk and then insert this empty code chunk at the end.
```{r download-answers, child = system.file("child_documents/download_answers.Rmd", package = "tutorial.helpers")}
```This will ask the student to provide an estimate of how long the tutorial took to complete. It will then provide the ability to download the student’s answers in html format. Students submit these files to their instructors, who can then confirm that the work was completed and look for any patterns in student (mis)understandings.
Recommended components
We recommend including this child document at the start of each tutorial:
```{r info-section, child = system.file("child_documents/info_section.Rmd", package = "tutorial.helpers")}
```This will insert (optional) questions asking for the student’s name, email and id.
We recommend ending the tutorial with the download-answers child document, as discussed above.