Exploring Statistics with R

An R workbook to accompany Exploring Statistics: Tales of Distributions

Learn introductory statistics by asking research questions, running analyses in R, and interpreting the results.

Prepared by Erick Axxe

NoteWelcome

If you are new to R, begin with Choose Your Path, then work through the remaining Start Here pages in order. If you already use R and RStudio, review the starter-file instructions and then begin Chapter 1.

Everyone needs the starter files. They contain the RStudio project, the EAMMi2 data, and the R scripts used with the workbook chapters.

How This Workbook Works

Each chapter begins with a research question from Exploring Statistics. You will plan the analysis, run R code, inspect the output, and write an interpretation in ordinary statistical language.

You do not need to memorize every R command. Early chapters provide complete examples and explain how the code is organized. Later chapters ask you to reuse and adapt familiar patterns with less guidance.

Most analyses follow the same routine:

  1. Identify the research question and variables.
  2. Decide what the analysis needs to show.
  3. Predict what you expect before running the code.
  4. Run one section of the chapter script.
  5. Inspect the output and check that it makes sense.
  6. Interpret the result in words.

Begin Here

  • Choose Your Path explains where to begin based on your R experience.
  • Set Up RStudio guides you through installing the software, downloading the starter files, and opening the project.
  • Run Your First Script introduces the RStudio panes and the basic ideas used in the chapter scripts.
  • Understanding EAMMi2 provides background about the study and a complete codebook for the variables used in the workbook.

Workbook Chapters

The workbook follows the textbook chapter sequence:

Chapter Statistical focus
1 Introduction and the R workflow
2 Frequency distributions and graphs
3 and 4 Central tendency and variability
5 Other descriptive statistics
6 Correlation and regression
9 One-sample designs
10 Two-sample designs
11 Independent-groups analysis of variance
12 Repeated-measures analysis of variance
13 Two-way analysis of variance
14 Chi-square tests
15 Nonparametric statistics

Help While You Work

Use the R Command Index to review commands, Troubleshooting when an analysis does not run as expected, and Statistical Language when you need a reminder about variables, distributions, or model formulas.