Task view: Teaching Statistics

Last updated on 2020-06-05 by Paul Northrop

This CRAN task view gives information about packages with features that are designed to assist with the teaching of Statistics. It is not concerned with the teaching of R itself. A few of these packages are listed in other task views, but only the Bayesian task view has a section devoted explicitly to teaching (Bayesian) Statistics.

The packages are grouped into three broad topics: teaching, examination and packages associated with Statistics books. The latter is for books that are general enough to be of potential interest to a wide audience of teachers of Statistics. They should concern models and methods with wide applicability and not be tied closely to a particular application.

If you think that a package is missing from the list, or have any other comments or suggestions, then please contact the maintainer.


  • Rcmdr provides a GUI for R, based on the tcltk package. A point-and-click interface loads data and calls R functions to perform the kinds of analyses involved in introductory Statistics courses. More advanced and specialized analysis are also available, some of them via plug-ins. The R commands are shown in the console. See the The R Commander homepage for more information.
  • swirl uses the R console to provide an interactive learning environment for students to learn Statistics. Students select courses to download from the swirldev/swirl_courses GitHub page and are provided with immediate feedback as they work. A variety of topics are available, under the general headings of Exploratory Data Analysis, Statistical Inference and Regression Models. Teachers can author and share their own swirl courses using the swirldev/swirlify package (currently on Github only). See also the swirl home page.
  • mosaic contains a wide range of tools to assist in teaching of basic, and more advanced ideas and techniques in mathematics, statistics, computation and modelling. Key aspects are the provision of functions that enable beginners easily to perform tasks that would otherwise be difficult and the use of simulation to illustrate randomization-based inference. See the Project MOSAIC homepage for more information.
  • xplain can be used to provide bespoke interactive interpretations of the output from statistics functions. This information needs to be provided by the instructor in XML format and may contain R code, to tailor the explanation to the specific results. See the xplain website for a tutorial and cheatsheet.
  • animation provides functions to produce animations relating to a wide range of topics in Statistics, Data Mining and Machine Learning. These animations, or a sequence of images generated by the user, may be exported to a variety of formats.
  • gganimate animates plots produced by ggplot2. It can be used to render the plots into an animation, such as a GIF or MP4 video .
  • smovie provides movies to illustrate concepts in Statistics. Topics covered are: probability distributions; sampling distributions of the mean (cf. central limit theorem), the maximum (cf. extremal types theorem) and the (Fisher transformation of the) correlation coefficient; simple linear regression; hypothesis testing.
  • visualize provides graphs of the pdf or pmf of various continuous and discrete probability distributions, annotated with the mean and variance of the distribution. Shading is used to indicate an interval (lower tail, upper tail, two-tailed or a user-supplied interval) within which the random variable lies with a user-supplied probability.
  • LearnBayes provides functions and to illustrate the essential ideas of Bayesian inference, such as the roles of the prior, likelihood and posterior; posterior predictive checking and predictive inference, and several example datasets.
  • TeachingDemos Provides a wide range of static and interactive plots to demonstrate statistical concepts, including: coin tossing and dice rolling; confidence intervals; various aspects of hypothesis testing; the central limit theorem; maximum likelihood estimation; scatterplot smoothing; histograms; correlation and simple linear regression; Box-Cox transformation.
  • distrTeach provides plots to illustate the Central Limit Theorem (CLT) and the Law of Large Numbers (LLN). The effects on the CLT plots of changing inputs can be shown using a Tcl/Tk-based widget.
  • learnstats uses a console-based menus and shiny apps to provide interactive plots that illustrate key statistical concepts. Topics covered include probability areas on density functions, binomial, normal, t and F distributions, p-values, QQ-plots and simulation of time series with different behaviours.
  • BetaBit provides games for students to play in the R console, including one that involves data-cleaning and regression modelling. See the BetaBit home page.
  • DALEX provides functions to explore and understand predictive models. The DALEX GitHub page includes two teaching-related showcases.


  • exams provides a framework for the automatic random generation of exams and self-study materials from a pool of exercises composed using either Sweave (.Rnw) or R markdown (.Rmd) formats. R code can be used to generate exercise elements dynamically. Questions can be formatted for use in a variety of e-learning platforms or output as documents, for example a PDF file, for which. Scans of PDF answer sheets can be marked automatically. See also the R/exams homepage
  • ProfessR creates multiple choice exams from a pool of exercises organised in ASCII test files. Multiple versions of an exam can be created by randomizing the questions and the choices of answers.
  • TexExamRandomizer enables the randomization of questions created using LaTeX's document class for preparing exams. Spreadsheets containing students' answers can be marked automatically.

Packages associated with Statistics books

The following packages are associated with textbooks that are of potential interest to a general statistical audience, rather than being specific to a particular application area. The general principle for inclusion is that package is likely to be of direct use in the teaching of statistical methods. Official publisher links are provided where possible and, in some cases, a link to further resources.


AER — 1.2-9

Applied Econometrics with R

animation — 2.6

A Gallery of Animations in Statistics and Utilities to Create Animations

ACSWR — 1.0

A Companion Package for the Book "A Course in Statistics with R"

BaM — 1.0.1

Functions and Datasets for Books by Jeff Gill

BayesDA — 2012.04-1

Functions and Datasets for the book "Bayesian Data Analysis"

BetaBit — 1.3

Mini Games from Adventures of Beta and Bit

Bolstad — 0.2-40

Functions for Elementary Bayesian Inference

car — 3.0-8

Companion to Applied Regression

carData — 3.0-4

Companion to Applied Regression Data Sets

DALEX — 1.3.0

moDel Agnostic Language for Exploration and eXplanation

distrTeach — 2.8.0

Extensions of Package 'distr' for Teaching Stochastics/Statistics in Secondary School

effects — 4.1-4

Effect Displays for Linear, Generalized Linear, and Other Models

exams — 2.3-6

Automatic Generation of Exams in R

faraway — 1.0.7

Functions and Datasets for Books by Julian Faraway

gganimate — 1.0.6

A Grammar of Animated Graphics

ggplot2 — 3.3.2

Create Elegant Data Visualisations Using the Grammar of Graphics

HH — 3.1-40

Statistical Analysis and Data Display: Heiberger and Holland

HSAUR3 — 1.0-9

A Handbook of Statistical Analyses Using R (3rd Edition)

infer — 0.5.2

Tidy Statistical Inference

ISwR — 2.0-8

Introductory Statistics with R

LearnBayes — 2.15.1

Functions for Learning Bayesian Inference

learnstats — 0.1.1

An Interactive Environment for Learning Statistics

MASS — 7.3-51.6

Support Functions and Datasets for Venables and Ripley's MASS

moderndive — 0.4.0

Tidyverse-Friendly Introductory Linear Regression

MPV — 1.55

Data Sets from Montgomery, Peck and Vining

msos — 1.1.1

Data Sets and Functions Used in Multivariate Statistics: Old School by John Marden

mosaic — 1.7.0

Project MOSAIC Statistics and Mathematics Teaching Utilities

openintro — 2.0.0

Data Sets and Supplemental Functions from 'OpenIntro' Textbooks and Labs

ProfessR — 2.4-1

Grades Setting and Exam Maker

Rcmdr — 2.6-2

R Commander

regtools — 1.1.0

Regression and Classification Tools

resampledata — 0.3.1

Data Sets for Mathematical Statistics with Resampling in R

shiny — 1.5.0

Web Application Framework for R

Sleuth2 — 2.0-5

Data Sets from Ramsey and Schafer's "Statistical Sleuth (2nd Ed)"

Sleuth3 — 1.0-3

Data Sets from Ramsey and Schafer's "Statistical Sleuth (3rd Ed)"

smovie — 1.1.2

Some Movies to Illustrate Concepts in Statistics

swirl — 2.4.5

Learn R, in R

SMPracticals — 1.4-3

Practicals for Use with Davison (2003) Statistical Models

TeachingDemos — 2.12

Demonstrations for Teaching and Learning

TexExamRandomizer — 1.2.3

Personalizes and Randomizes Exams Written in 'LaTeX'

vcd — 1.4-7

Visualizing Categorical Data

visualize — 4.4.0

Graph Probability Distributions with User Supplied Parameters and Statistics

wooldridge — 1.3.1

111 Data Sets from "Introductory Econometrics: A Modern Approach, 6e" by Jeffrey M. Wooldridge

xplain — 0.2.1

Providing Interactive Interpretations and Explanations of Statistical Results

Task view list