The IQUIT R video series

[This article was first published on Maxwell B. Joseph, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve uploaded 20+ R tutorials to YouTube for a new undergraduate course in Ecology and Evolutionary Biology at CU developed by Andrew Martin and Brett Melbourne, which in jocular anticipation was named IQUIT: an introduction to quantitative inference and thinking.

We made the videos to address the most common R programming problems that arose for students in the first iteration of the course. These short tutorials may be of use elsewhere:

Introduction to R

  • everything is an object
  • addition, subtraction, multiplication
  • assignment

Numeric vectors: 1

  • vectors vs. scalars
  • create vectors with c()

Numeric vectors: 2

  • how to explore the structure of a vector
  • class, length, str

Functions in R

  • input and output
  • single argument functions: sqrt, log, exp
  • multi-argument functions: round

Creating special vectors: sequences and repetition

  • generate integer sequence: :
  • create sequence seq (hit args)
  • repeat something rep (also note argument structure)

Relational operators and logical data types

  • logical types (intro to relational operators)
  • ==, !=, >, <, >=, <=
  • TRUE and FALSE

Character data

  • character objects
  • character vectors
  • relational operators on character vectors

2-d data structures: matrices and data frames

  • data frames can hold lots of different data types
  • matrix elements must be of the same type

Intro to indexing: matrices and vectors

  • indexing and subsetting with [
  • review str
  • a bit with relational operators

Data frame subsetting and indexing

  • indexing with relational operators
  • 3 ways to subset data frame: df[c 1="names")" language="("column"][/c], df$column, df[, 1]

R style & other secrets to happiness

  • basics of R style: spacing, alignment,
  • breaking up run-on lines
  • workspace management
  • ls, rm
  • choosing good names for files and objects
  • commenting

Working with data in R: 1

  • reading in data with read.csv
  • automatic conversion of missing values to NA

Working with data in R: 2

  • mixed type errors (numbers read in as characters because one cell has a letter)
  • search path errors

Visualization part 1: intro to plot()

  • plot
  • arguments: xlab, ylab, col

Visualization part 2: other types of plots

  • histograms, jitter plots, line graphs

Visualization part 3: adding data to plots

  • adding points
  • adding lines, and segments (also abline)

Visualization part 4: annotation and legends

  • annotation via text
  • adding legends

Visualization part 5: graphical parameters

  • commonly used parameters
  • for points: col, cex, pch (see ?points for pch options)
  • for lines: col, lwd, lty

Looping repetitive tasks

  • the power of the for loop
  • creating objects to hold results ahead of time, rather than growing objects

Summarizing data

  • mean, sd, var, median

Randomization & sampling distributions

  • sample and rep

Debugging R code 1: letting R find your data

  • working directory errors when reading in data
  • problems with typos, using objects that don’t exist

Debugging R code 2: unreported errors

  • errors do not always bring error messages
  • steps to finding & fixing errors

Replication and sample size

  • explore the effect of n on the uncertainty in a sample mean

Conveying uncertainty with confidence intervals while not obscuring the data

  • constructing confidence intervals
  • plot CIs using the segments function

Differences in means

  • given two populations, simulate the null sampling distribution of the difference in means
  • randomly assign individuals to a group using sample or some other scheme, then iteratively simulate differences in means with CIs

To leave a comment for the author, please follow the link and comment on their blog: Maxwell B. Joseph. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)