Introduction to R

The R programming language, a favorite among biologists, provides useful tools for applied statistical analysis. Subsequent pages on StatsTree will provide code snippets in R to serve as learning tools, but also as practical instructions that one may use to analyze real data.

 

Additional Resources


McAdam: Introduction to R

McAdam: R Data Import and Basic Figures

Whitlock & Schluter - The Analysis of Biological Data

Online resource: Loading R and RStudio option 1

Online resource: Loading R and RStudio option 2

Online resource: Introduction to R, Part I

Online resource: Introduction to R, Part II

 

R Tutorial

Intro: Beginning with how to download R and RStudio, and covers basic functions and plotting.

 

Plotting in R

Intermediate: How to create basic plots in R.

 

Introduction to R by Venables and Ripley

A good introductory text on the basics of R and statistical analysis using R. This link goes to a free PDF copy of the book.

 
 

Exploratory data analysis

Advanced: R scripts showing some simple exploratory data analyses in R.

Base R Cheat Sheet

A basic summary of some common commands

Importing and analyzing data

Intro: How to import and begin analyzing data in RStudio.


Review Questions

 
  1. Enter the code for the following review questions into a script In R. How do you save the value “10.23” as a variable called “my_var”? (there are multiple correct answers)

  2. Use the mean() function to find the mean value from the vector c(11.78, 9.45, my_var). How would you find the standard deviation?

  3. Save your code as “practice_code.R“ in your Desktop folder.

The Next Steps


Confused?

Let’s move down the tree and review these concepts.

Ready to Move Forward?

Let’s move up the tree to the next topic.