1
Index
1.1
Preface
2
Introducing R and Rstudio
2.1
Intro
2.2
Why use R for data analysis?
2.3
R and RStudio: What is the difference?
2.4
Installing R and RStudio
2.5
The interface of RStudio
2.5.1
Console
2.5.2
Scripts
2.5.3
RMD Files
2.5.4
Environment
2.5.5
Plots, Packages, and Help
2.6
File Directories in R
3
Objects and Functions
3.1
Intro
3.2
Functions
3.3
Objects
3.4
Object classes and types
3.4.1
Vectors
3.4.2
Matricies
3.4.3
Lists
3.4.4
Data Frames
3.4.5
Types
3.5
Subsetting
3.6
Base R
3.7
Environment
3.8
Putting It All Together: read.csv
4
Using dplyr
4.1
Intro
4.2
dplyr Functions
4.2.1
Select, filter, and arrange
4.2.2
Mutate and summarize
4.2.3
Spread, Gather, Separate and Unite
4.2.4
Renaming variables
4.2.5
Using the pipe
4.2.6
Editing factor variables: recode() and relevel()
5
Creating Graphs With ggplot2
5.1
Base R vs. ggplot2
5.2
ggplot2
5.2.1
Introduction
5.3
ggplot Aesthetics
5.3.1
Scatterplot
5.3.2
Colors in R
5.3.3
Line of best fit
5.3.4
Box and whisker
5.3.5
Barchart
5.3.6
Other aesthetics
5.4
Additional customization
5.4.1
Titles and Labels
5.4.2
Colors
5.4.3
Sizes and shapes
5.4.4
Themes
5.4.5
Reversing the axes
5.4.6
Facets
5.4.7
Exporting your plot
6
Working with Tables in R
6.1
Intro
6.2
Creating Basic Tables: table() and xtabs()
6.3
Tabular Data Analysis
6.3.1
Tests for Independence
6.3.2
Defining Independence
6.3.3
Chi-Square Test for Independence
6.3.4
Fisher’s Exact Test
7
Statistical Fundamentals
7.1
Intro
7.2
Statistical Inference
7.2.1
Parameter Estimation: Mean, Median, tutorial, Quantiles
7.2.2
Accounting for estimation variance and hypothesis testing
7.2.3
Confidence intervals
7.2.4
Hypothesis testing
7.2.5
Hypothesis Testing with Means
8
Regression Analysis Methods
8.1
Intro
8.2
Linear Regression
8.2.1
Motivation
8.2.2
Methodology
8.2.3
Overview
8.2.4
Example 1: Continuous predictors
8.2.5
Example 2: Categorical predictors
8.2.6
Diagnostics
8.2.7
ANOVA and ANCOVA
8.3
Logistic regression
8.3.1
Methodology
8.3.2
Example 1: Continuous Covariates
8.3.3
Example 2: Categorical Covariates
8.3.4
Prediction
8.4
Mixed Models
8.4.1
Motivation
8.4.2
Example: Mullen composite and Visit
8.4.3
Interpreting results: time dependent covariates
9
Documenting your results with R Markdown
9.1
Intro
9.2
Starting Your R Markdown
9.3
Understanding the R Markdown editor
9.3.1
Prelude
9.3.2
Chunk
9.3.3
Non-chunk
9.4
Creating your document from the R Markdown file
9.5
Creating tables with R Markdown
9.5.1
Summary statistics
9.5.2
General tables
9.6
Practice with R Markdown
10
Loops and Functional Programming
11
Intro
11.1
Loops
11.1.1
Example 1: Running many regression models
11.1.2
Example 2: The Apply Functions
11.2
Functional Programming
11.2.1
Example: Regression Analysis as a Function Call
11.3
Simulation Studies
11.3.1
Setting the Seed: Reproducibility in Simulation Studies
Data Analysis and Processing with R based on IBIS data
10
Loops and Functional Programming
library
(tidyverse)