**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:

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

- vectors vs. scalars
- create vectors with
`c()`

- how to explore the structure of a vector
`class`

,`length`

,`str`

- 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 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

- reading in data with
`read.csv`

- automatic conversion of missing values to
`NA`

- mixed type errors (numbers read in as characters because one cell has a letter)
- search path errors
`is.na`

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`

- the power of the
`for`

loop - creating objects to hold results ahead of time, rather than growing objects

`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

- 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

- 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

**leave a comment**for the author, please follow the link and comment on their blog:

**Maxwell B. Joseph**.

R-bloggers.com 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.