What are R and RStudio`?

R is a free software environment for statistical analysis and graphics. RStudio is a user interface through which to use R. RStudio adds functionality that make working with R easier, more efficient, and generally more pleasant than working in R alone.

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

What is discovr?

The discovr package contains a series of interactive tutorials that teach R alongside chapters of my textbook Discovering Statistics using R and RStudio. 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 R-related) and offered to support tutors and students using my textbook.

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.

  • discovr_01: Key concepts in R and R Studio

Installing discovr

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

Once you have installed R and RStudio you can install discovr. The package is in development so you have to install it from github. To install the package execute (in RStudio):

install.packages("remotes") #if you don’t already have it installed
library(remotes)
remotes::install_github("profandyfield/discovr")

To run a particular tutorial execute:

library(discovr)
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 a web browser.

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 open two RStudio sessions (i.e. two RStudio windows running simultaneously). Use one RStudio session to run the tutorial. You won’t then be able to use this RStudio window (because its resources are allocated to the tutorial). In the second RStudio session try replicating what you learn in the tutorial. That is, open a new script file and everything you do in the tutorial, practice in the script file (and save it). 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 use my other package of tutorials, adventr, within my own classes. I’d adopt the same workflow with discovr.

Other resources

Statistics

  • The tutorials typically follow examples described in detail in (Field 2020), so for most of them there’s a thorough account in there.
  • There are free lectures and screencasts on my YouTube channel
  • There are free statistical resources on my website www.discoveringstatistics.com

R

References

Field, Andy P. 2020. Discovering Statistics Using R and RStudio. 2nd ed. London: Sage.

Copyright © 2000-2019, Professor Andy Field.