In this unit, you will learn how to create functions and learn some programming tricks.
Follow the links to each lecture, lab, and reading.
Scroll down to download the SWIRL lessons.
Lecture: Writing your own functions
SWIRL: Writing functions
Lab: Unit 6: Lab 1
Reading: Best practice for writing R code
Lab: Unit 6: Lab 2
Reading: Crawley, M. The R Book Ch 2. Essentials of the R Language. 2.10 Loops and repeats
SWIRL: Sampling and simulation
Lab: Unit 6: Lab 3
Reading: Crawley, M. The R Book Ch 2. Essentials of the R Language. 2.9 Random numbers, shuffling, and sampling