What is adventr?

The adventr package [fieldAdventureStatisticsReality2016] contains a series of interactive tutorials that teach alongside chapters of my 2016 textbook An Adventure in Statistics: the reality enigma. The tutorials are written using a package called learnr. Once a tutorial is running it’s a bit like reading a book but with places where you can practice the R code that you have just been taught. The adventr package is free (as are all things -related) and offered to support tutors and students using my textbook who want to learn R.

What are R and RStudio`?

R is a free software environment for statistical analysis and graphics. is a user interface through which to use . 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 adventr

The package was written initially to support my own teaching on a module where I base the content around An Adventure in Statistics. One quirk of this is that there are some advanced tutorials on topics not covered in the book (but continue the themes of the book …). Another quirk is that - at present - there are some chapters that don’t have associated tutorials (for example, the Chapter on probability).

The tutorials are named to correspond (roughly) to the relevant chapter of the book. For example, adventr_03 would be a good tutorial to run alongside teaching related to chapter 3, and so on.

  • adventr_02: Data basics in R and RStudio
  • adventr_03: Summarizing data (introducing ggplot2)
  • adventr_04: Fitting models (central tendency)
  • adventr_05: Presenting data (summarizing groups and more ggplot2)
  • adventr_08: Inferential statistics and robust estimation (covers Chapter 9 too)
  • adventr_11: Hypothesis testing
  • adventr_14: The general linear model
  • adventr_15: Comparing two means
  • adventr_15_rm: Comparing two means (repeated measures)
  • adventr_16: Comparing several means
  • adventr_16_rm: Comparing several means (repeated measures)
  • adventr_17: Factorial designs
  • adventr_mlm: Multilevel models (not covered in the book)
  • adventr_growth: Growth models (not covered in the book)
  • adventr_log: Logistic regression (not covered in the book)

Installing adventr

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

You can install the latest official release of adventr from CRAN in the usual way. Note that you should include dependencies = TRUE to also install the packages used in the tutorials on your system. If you omit this argument, you will need to manually install these packages (which you won’t want to do, trust me).

install.packages("adventr", dependencies = TRUE)

If you want the very latest development version, you can install it from GitHub by executing (in ):

if(!require(devtools)){
  install.packages("devtools")
}

devtools::install_github("profandyfield/adventr", dependencies = TRUE)

Running a tutorial

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

library(adventr)

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

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

library(adventr)
learnr::run_tutorial("name_of_tutorial", package = "adventr")

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("adventr_03", package = "adventr")

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 at the same time. However, to get the most from them I would recommend that you create an 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 itself.

Here’s a video explaining how I suggest you use the tutorials:

Other resources

Statistics

  • The tutorials typically follow examples described in detail in Field (2021). That book covers the theoretical side of the statistical models, and has more depth on conducting and interpreting the models in these tutorials.
  • If any of the statistical content doesn’t make sense, you could try my more introductory book An adventure in statistics (Field 2016).
  • There are free lectures and screencasts on my YouTube channel.
  • There are free statistical resources on my websites www.discoveringstatistics.com and milton-the-cat.rocks.

References

Field, Andy P. 2016. An Adventure in Statistics: The Reality Enigma. London: Sage.
———. 2021. Discovering Statistics Using R and RStudio. Second. London: Sage.
Wickham, Hadley, and G. Grolemund. 2017. R for Data Science. Sebastopol, CA: O’Reilly.

Copyright © 2000-2019, Professor Andy Field.