## Contents

- Helper functions
- Tutorials: Basic Topics
- Tutorials: Advanced
- Webcasts
- Visual walk-throughs
- Flow Charts
- Worked examples from Biological Data Analysis, 2nd ed

## R helper functions

Simple functions and wrappers to help students with basic R tasks.

**binom.CI():** Calculates Wilson’s (1927) confidence interval for a binomial proportion.

**plot.means():** Makes basic, annotated plots of means w/ approximate 95% confidence intervals from user-supplied standard errors or confidence intervals

**plotTukeysHSD():** makes basic, annotated plot of output of R’s TukeyHSD function (but prettier, IMHO)

## R Tutorials: Basic Topics

Code demonstrating basic R tasks.

**Loading (messy) data into R**: Outline for some tricks to get your data into R.

**Plotting means w/ errbar(): **making plots with the errbar() function in the Hmisc package

**Creating factors/categorical variables:** one of the most annoying things in R…

**Paired t-test walk through** (sorry, data not provided).

**Paired t-tests: 2 equivalent ways.** two ways to do a paired t-test w/ different syntax or data formatting.

**Basic R analysis tasks:** General walk through of math, summary(), and basic plots.

**Standard error for the difference between 2 means: **functions for pooled variance and SE of difference, for calculating t-statistics

## R Tutorials: More Advanced

**Reshaping data:** outline of notes on basic data re-shaping

## Webcasts:

### General R Tasks:

**Common problems and headaches:** how to get things working again when R and RStudio seem broken (also on YouTube)

**Explanation (also on YouTube)**

**Example**

### Doing Stats in R:

**Introduction to ANOVA Part 1 (Lab 9):** Summary statistics.

**Introduction to ANOVA Part 2 (Lab 9): **ANOVA

## Handouts

### R Handouts

Double-sided summaries of important R tasks, functions, and output

**Adding a new column to a R dataframe**

**Interpreting leverage & cooks distance plots**

## Visual Walk-throughs

Slides demonstrating basic R tasks.

**Downloading R & Rstudio: Windows**

**Dude, where’d RStudio’s script editor go?**

## Flow charts

**One-way ANOVA** (assumes alpha = 0.05)

## R labs:

From CalU of PA ENS 495: Design & Analysis, Fall 2016

**Lab 1: Intro to R. ** Intro to R, plotting eagle populations, etc

**Lab 2a: Displaying Data: **boxplot() and hist()

**Lab 2b: Displaying Data: **plotting means

**Lab 3a: Basic math for stats in R: **mean, variance, standard deviation, standard error

**Lab 4: Working with grouped data**: using subset() and tapply(), plotting group means, etc

**Lab 6a: Basic data plotting review.**

**Lab 6b: In class plotting exercise.**

**Lab 7: t-tests. ** 1-sample, 2-sample, paired

**Lab 9a: ANOVA. **1-way ANOVA to investigate impacts of diet on deer antler growth. See the videos Part 1 and Part 2.

**Lab 9b: data. ** Deer antler datasets for 1-way ANVOA

**Lab 11a: More regression:** Linear regression

**Lab 11b: More regression:** logistic regression

**Lab 11c: More regression: **multiple regression

**Lab 12: Regression Diagnostics. **qqplots, leverage and Cook’s distance, etc.

## Independent Project:

**Sample content in RPubs of final paper: **Sample content for a complete term paper

## Code for Lectures:

**Final Lecture a:** Reporting results of 1-way ANOVA for independent project

**Final Lecture b: **2-way ANOVA

## Misc examples:

**Loading R Code By hand (see the video)**

**How R works with strings of numbers: **or always put numbers in “c(…)”!

**Impact of sample size on precision.**

## Whitlock & Shulter’s Biological Data Analysis

Worked examples from Analysis of Biological Data, 2nd ed.

**Chapter 12: Question 18 **2 sample t-test example

**Chapter 12: Question 20** Paired t-test example