STAT 484/485: Topics in R Statistical Language

About these courses

Welcome to the course notes for STAT 484 & 485: Topics in R Statistical Language. These notes are designed and developed by Penn State’s Department of Statistics and offered as open educational resources. These notes are free to use under Creative Commons license CC BY-NC 4.0.

This course is part of the Online Master of Applied Statistics program offered by Penn State’s World Campus.

Ready to enroll?

Currently enrolled?

If you are a current student in this course, please see Canvas for your syllabus, assignments, lesson videos, and communication from your instructor.

R

Since its release in 1997, R has emerged as a popular tool for statistical analysis and research. The flexibility and extensibility of R are key attributes that have driven its adoption. Some of the advantages of R are related to the command line interface (CLI) form in which it is used. However, this does add to the challenge of learning to use R. The goal of this course is to build familiarity with the basic R toolkit for statistical analysis and graphics.

R is a flexible and powerful toolkit, but the learning curve can be pretty steep, especially at first (I can remember quite well the frustration I experienced when I first started using R!). These lessons will teach many of the basic tools included in R, and teach you how to keep learning how to use R.

Remember that R is much more than a “statistical package” - R is a language. I find that I am less frustrated with some of the foibles of R when I remember that it is a language, and that while mastering a language takes years of study and practice, you can quickly learn the minimum that you need to do your simpler common tasks.

You can download R from CRAN (the Comprehensive R Archive Network).

I also suggest that you download and install RStudio, which creates a nicer user interface for R. RStudio is not necessary, but once you have used it, you probably won’t want to use R without it. Note: If you dont have privileges to install RStudio in lab PCs, it may be possible to install it on a USB drive.

You will need to download, and likely print, the course notes (Essential R) which are found on Essential R - Notes on Learning R.

Lessons

STAT 484

Getting Started: Basic R

Data
R Code
Rstudio
Vectors
R Console
Loops

Qualitative Data

Data
R Code
Qualitative data
Factor levels
Hypothesis testing

Quantitative Data

Quantitative data
Histograms
Boxplots
Hypothesis tests
Mean
Median
Standard deviation

Documenting Work

Documentation
markdown
HTML
scripts
knitr

Finding Help

Help files

Working with Two Variables

Frequency tables
Chi-square
Barplots
Mosaic plots
Scatterplot
Correlation
Regression
T-tests

The Data Frame

Lists
Data frames
Metadata

Importing Data

text files
working directory
data import

Manipulating Data and Repetitive Tasks

Summarizing data
Sorting
Stacking
Data manipulation

Multivariate Data

Lattice graphs
Principal components analysis
Clustering
No matching items

STAT 485

Linear Regression

Regression
Prediction
Confidence intervals

ANOVA

Categorical predictors
ANOVA
Multiple predictors
Tukey

More Linear Models

Multiple regression
ANCOVA
Contrasts

Advanced Documentation

Rmarkdown
LaTeX
Knitr
Rstudio

Visualizing Data I - Enhancing Scatter Plots

plot()
lines()
layout()
Panels
Loops

Visualizing Data II - Errorbars and Ribbons

Errorbars
Confidence intervals

Mixed Effects Models

Mixed effects model
Repeated measures

Non-linear Models

Logistic model
non-linear models

Writing Functions and Packages

Functions
Errors
Packages
No matching items