Overview of the course 1 (pdf)

### Basic Materials R-course 2016

R for Beginners book. A
nice beginners book for R. Homework involves reading from this book.

Introduction to R book. A rather
nerdy but good introduction to R. Homework involves also reading from this book.

R Reference Card. This pdf gives a nice overview
of functions. Print it out and have on your desk when R-ing.

### Lecture Materials and Assignments

Lecture 1 Lecture 2 Lecture 3

Lecture 4 Lecture 5 Lecture 6

Lecture 7 Lecture 8 Lecture 9

Lecture 10 Lecture 11 Lecture 12

Exam

### Lecture 1, September 26^{th}

Here, you can find the slides and the code that discuss in class: Slides lecture 1, Code shown in lecture 1

*Homework for next class*

Read R for Beginners, chapters 2.1 - 2.3 and Introduction to R, chapters 2.1 - 2.6. Then do the exercises below. Assignment of lecture 1.

Solutions to the assignment of lecture 1.

### Lecture 2, October 3^{rd}

*Homework for next class*

Read Introduction to R, chapters 2.7 - 3.2 and 5.1 - 5.3. Then do the exercises below.

Exercises of lecture
2.

Solutions to the
exercises of lecture 2.

### Lecture 3, October 10^{th}

Materials of lecture 3
*Homework for next class*

Read R for beginners, chapters 3.2 - 3.3 and 3.5.1 (you
can skip *Time series* and *Expressions*) Then do the exercises in assignment materials
below.

Assignment materials of
lecture 3.

Solutions to
the exercises of lecture 3.

### Lecture 4, October 17^{th}

Code discussed in lecture 4

*Homework for next class*

Read chapter 4.5.1 of this pdf. (there's more advanced stuff in this pdf
if you like). Furthermore, for more about indexing, read R for beginners, chapters 3.5.2 - 3.5.5.
Then do the exercises below.

Assignment lecture 4

Solutions to the exercises of
lecture 4.

### Lecture 5, October 24^{th}

Materials of lecture 5

*Homework for next class*

Both manuals are not too clear on this, so read chapter 6.1
till 6.2.2 from this webpage.
Then do exercises below.

Exercises of lecture 5.

Solutions to the
exercises of lecture 5.

### Lecture 6, October 31^{st}

Code discussed in lecture 6

Presentation slides lecture 6

*Homework for next class*

Read the help functions of apply, tapply, and lapply,
then do the exercises below.

Exercises of lecture 6

Solutions to the
exercises of lecture 6.

### Lecture 7, November 7^{th}

Code discussed in lecture 7

Presentation slides lecture 7

*Homework for next class*

Read Introduction to R: 12.1 and 12.2, R for beginners: 4.2
and 4.3., then do the exercises in the materials for assignment 7

Solutions to the exercises of
lecture 7.

### Lecture 8, November 14^{th}

*Homework
for next class*

Have a look at Google's R-style guide.
This guide teaches you a consistent way to name variables and use spacing. If you follow these
rules, your own code will become easier to read for everyone, including yourself. Further, to
understand simulating a bit more thoroughly, watch this 15 minute Youtube video.

Then perform the Exercises of lecture 8.

Solutions to the exercises of
lecture 8.

### Lecture 9, November 21^{st}

*Homework for next class*

Read R for Beginners chapter
5.1, 5.2, and 5.3. Mind that where the book speaks of aov(), we mainly used lm() in class.
Furthermore, it is important to understand the generic function part (5.3). If you are
comfortable with statistics, the discription of linear models in Introduction to R, chapter 11 offers
a more generic understanding of fitting linear models in R.

Then perform the Exercises of lecture 9.

Solutions to the exercises of
lecture 9.

### Lecture 10, November 28^{th}

*Homework for next class*

Re-read Introduction to R, chapter 12 until 12.2.1 and see how much sense all makes to you now.

Then perform the assignment
of lecture 10.

Solutions to the
exercises of lecture 10.

### Lecture 11, December 5^{th}

Code and presentation discussed in lecture 11

*Homework for next class*

Read help: ?"function", ?return, ?invisible
and if you have difficulties understanding functions, take 6 minutes to view this youtube video.

Then perform the Assignment
materials of lecture 11.

Solutions to the
exercises of lecture 11.

### Lecture 12, December 12th

### Exam, December 12th till December 23rd

Please download the Exam folder and perform the "exam"-assignment.
It is not much different from regular assignments. It's only 50% more and just repetition. So, plan well; don't start on the 22nd!

Good luck!

Solutions to the exam.

### Online Resources

CRAN is the main website for R. (Comprehensive R Archive Network). Here you can download R to install on your Windows, Mac, or Linux system. Also, this site is the main source to find information about R. There are of course many more place on the web where you can find information. Just search for it. Literally googling/duckduckgoing error messages very often will help you out.

### About the Assignments

Save assignments to your computer and fill in the answers between the === lines ===. Out-comment your eventual comments with #. Every line that is not
commented out should be working code and contain *only* the answer. Keep format as .R and
don't delete the questions. Email this .R-file the Friday before the next
lecture 18.00 the latest to gilles.dutilh [at] unibas.ch.

You can work together on the assignments. Just do not copy, I will notice. If you work together, please send in together. Note that you may always email me with questions. Solutions to the assignments will be uploaded with the next lecture's materials.

Archive of the R course. (zip, 50mb) This archive is available here mainly for external students interested in learning R. Students following the R-course at University Basel: I do not recommend downloading this archive. I will upload new materials each week.