discovr: a package of interactive tutorials

What is discovr?

The discovr package will contain tutorials associated with my textbook Discovering Statistics using R and RStudio, due out in early 2021. It will include all datasets, but most important it will contain a series of interactive tutorials that teach alongside the chapters of the book. The tutorials are written using a package called learnr. Once a tutorial is running it’s a bit like reading excerpts of the book but with places where you can practice the R code that you have just been taught. The discovr package is free (as are all things -related) and offered to support tutors and students using my textbook.

What are R and RStudio?

If you’re using a textbook about then you probably already know what it is. If not, R is a free software environment for statistical analysis and graphics. RStudio is a user interface through which to use . RStudio adds functionality that make working with easier, more efficient, and generally more pleasant than working in alone.

You can get started with R and RStudio by completing this tutorial (includes videos):

Contents of discovr

The tutorials are named to correspond (roughly) to the relevant chapter of the book. For example, discovr_04 would be a good tutorial to run alongside teaching related to chapter 4, and so on. Some longer chapters have several tutorials that break the content into more manageable chunks. Given the current global situation and the fact that lots of instructors are needing to teach remotely I’m making what I have available before the book is finished and will update as and when new tutorials are written.

Installing discovr

This package is incomplete but under active development. I have released it early in case it is useful for instructors needing to move rapidly to remote learning because of the current global pandemic. Check the GitHub page for updates/new tutorials.

To use discovr you first need to install and RStudio. To learn how to do this and to get oriented with and RStudio complete my interactive tutorial, getting started with R and RStudio.

You can get the development version of the package from github.com/profandyfield/discovr.

Running a tutorial

In RStudio Version 1.3 onwards there is a tutorial pane. Having executed


A list of tutorials appears in this pane. Scroll through them and click on the Start tutorial button button to run the tutorial:

Alternatively, to run a particular tutorial from the console execute:

learnr::run_tutorial("name_of_tutorial", package = "discovr")

and replace “name of tutorial” with the name of the tutorial you want to run. For example, to run tutorial 3 (for Chapter 3) execute:

learnr::run_tutorial("discovr_03", package = "discovr")

The name of each tutorial is in bold in the list above. Once the command to run the tutorial is executed it will spring to life in the tutorial pane.

Suggested workflow

The tutorials are self-contained (you practice code in code boxes) so you don’t need to use RStudio at the same time. However, to get the most from them I would recommend that you create an RStudio project and within that open (and save) a new RMarkdown file each time to work through a tutorial. Within that Markdown file, replicate parts of the code from the tutorial (in code chunks) and use Markdown to write notes about what you have done, and to reflect on things that you have struggled with, or note useful tips to help you remember things. Basically, write a learning journal. This workflow has the advantage of not just teaching you the code that you need to do certain things, but also provides practice in using RStudio itself.

Here’s a video explaining how I suggest using the tutorials.

Other resources