The IQUIT R video series

August 28, 2015

(This article was first published on Maxwell B. Joseph, and kindly contributed to R-bloggers)

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, 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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


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)