Intro to coding in R

Introduction:

Most ecologists analyze their data in the programming language R. Part of the scientific process is analyzing and interpreting the data you collected. In this section, I'm including some resources for learning how to code in R and best practices for analyzing your data.

Why not Python?

Many ecologists use R, but not all. Some ecologists use python (mainly bioinformaticians or those who write large simulations) or matlab (mainly theoreticians). I think R is preferred within ecology because it is easy to organize and query medium-sized datasets (usually data isn't large enough to use a language optimized for querying databases like SQL), running statistical analyses with easily-referenced packages, and making nice graphics.

How to install R and RStudio:

Installing R:

  1. Download R: Choose 1 to download (doesn't matter which one)

  2. Download and install RStudio: This is an IDE for using R

See my video about how to install R and RStudio: https://youtu.be/d-sEdgdduFc


Callie's Resources:

I've made a variety of resources for learning R, mainly geared towards students in Stanford's BIO 47 course (Introduction to Research in Ecology and Evolution). Please see below links to videos.

R for Beginners:

  1. Installing R and RStudio

  2. Introduction to RStudio

  3. R Basics (Introduction to R)


R for Just beyond-beginners:

  1. Introduction RMarkdown

  2. Introduction to the Tidyverse: Data Wrangling with dplyr

  3. Introduction to the Tidyverse: Data Visualization with ggplot2

Click this to see the knitted demo .Rmd file for the R Markdown, dplyr, and ggplot2 videos.

Non-Callie Resources:

Beginner resources:

If you are learning R for the first time, I would strongly suggest using the EdX course (bolded).

Interactive tutorials:

Online Courses:

Junior-Varsity resources:

Ecology-specific resources:

Tidyverse:

Textbooks:

Making graphics:

Using RMarkdown:

I write scripts and document code using RMarkdown. RMarkdown helps generate reproducible and easy-to-follow documentation of analyses, output, and code. See my RMarkdown video above!

Fun stuff:

Advanced resources:

Using Bioconductor:

Microbiome analyses:

RNASeq:

Teaching R:

Advanced R graphics:

Using Git in RStudio:

Callie Chappell