Main Information

Semester: Basel, Fall, 2017/2018

Location: Missionsstrasse 64a, Computerraum 00.010

Course meeting times:

  • Session 1: Wednesdays, 14:15 - 15:45
  • Session 2: Wednesdays, 16:15 - 17:45

Syllabus (you’re looking at it): https://ndphillips.github.io/IntroductionR_Course/

Instructor: Nathaniel Phillips, nathaniel.phillips@unibas.ch

Schedule

Your homework for each class period is to actively read the readings for that week. The videos are optional and do not cover any new material. All of the work you turn in will be done in class as WPAs (Weekly Programming Assignments).

If you have trouble opening a link, try right–clicking and opening in an new browser tab.

Week - Date Topic Reading Assignment
1 - 20 Sep Introduction Day 0 Presentation WPA #0
2 - 27 Sep R basics, scalers and vectors YaRrr Ch: 1, 2, 3, 4, 5, 6
Videos: A, B, C
WPA #1 - Answers
3 - 4 Oct Indexing Vectors YaRrr Ch: 7
Videos: D
WPA #2 - Answers
4 - 11 Oct Matrices and Dataframes YaRrr Ch: 8
Videos: E, F
WPA #3 - Answers
5 - 18 Oct Managinge projects and workspaces. Dataframe manipulation YaRrr Ch: 9, 10
Videos: G
WPA #4 - Answers
6 - 25 Oct Plotting R for Data Science
Data Visualisation,
Exploratory Data Analysis
WPA #5 - Answers
7 - 1 Nov 1 and 2 sample Hypothesis tests YaRrr Ch: 13 WPA #6 - Answers
8 - 8 Nov ANOVA with aov() YaRrr Ch: 14 WPA #7 - Answers
9 - 15 Nov Linear regression with lm(), glm() YaRrr Ch: 15 WPA #8 - Answers
10 - 22 Nov Writing Functions and Loops YaRrr Ch: 16, 17 WPA #9 - Answers
11 - 29 Nov R Markdown and papaja Markdown Video
Markdown Guide
RStudio Lessons
papaja Guide
WPA #10 - Answers
12 - 6 Dec Final project work Final Project Description
Getting Random Data
13 - 13 Dec Final project work - -
14 - 20 Dec Final project work - -
End - 5 Jan Final project Due!!! - -

R Installation

You need to install two pieces of software for this course: R, and RStudio.

WPA Submission Page

Link Description
WPA Submission Page After you have emailed your WPA to me, submit your assignments here

Cheat Sheets

Link Description
Base R Cheat Sheet A simple cheat sheet covering many basic R functions
R Reference Card A handy R cheat sheet covering many, many functions.
RStudio Cheat Sheet A cheatsheet for the RStudio environment
Data Import Cheat Sheet A cheatsheet for the RStudio environment
R Markdown Cheat Sheet A cheatsheet for writing documents with RMarkdown
RStudio Cheat Sheets R Studio provides the above cheat sheets, as well as many more, here

Helpful sites

Link Description
Google R Style guide Google provides a nice style guide for progamming in R
http://r-bloggers.com The #1 place to hear the latest and greatest R news. Tons of great new R content every day. I encourage you to sign up for their email list!
http://rseek.org/ Use it like Google – it only returns R related topics.

5 Great question to ask when you get stuck

The best advice I can give you to help you learn R is to ask questions…constantly. I learned almost everything I know about R from asking other people for help. If you find that you are stuck on a problem, here are some 5 great questions that I love to hear from students:

Level Problem Question
1 You don’t understand the problem and you have absolutely no idea how to get started. Can you please help explain what the problem is and what I am supposed to do??
2 You understand the problem but you’re not sure what a solution would look like. Can you please help me get started?
3 You understand the problem and you (think you) know a solution, but your code is not working the way you want it to. Can you please help me figure out what’s wrong with my code?
4 You understand the problem, and you have a solution that works, but you don’t know why and how it works. Can you please explain how and why this code works?
5 You understand the problem, you have a solution, and you know why it works, but you don’t know if it is the best way to solve the problem. Can you please help me figure out a better way to solve this problem?

Course Description

R is one of the most popular statistical languages for both academic researchers and data analysts working in industry. The reason why is simple - R is free, easy to use and incredibly powerful. With R you can generate and manipulate data, conduct analyses, create plots and even write documents. The goal of this course is to introduce you to R so you can apply it to your current and future research. In this course, you will learn how to use R to conduct all steps of your data analysis, from loading data to performing analyses, to producing reports.

This course is for anyone who wants to learn R. I don’t care if you’re 10 or 100 or what your background is in programming, math, or pirate history. If you want to learn R and know how to use a computer, this course is for you. That said, the course is designed around the needs of a psychology student in a Bachelor’s, Masters, or PhD program who has taken at least an introductory course in statistics.

This is not a traditional course – this is a ‘flipped’ course. This means that you will be learning the basic material on your own time outside of class, by actively reading and watching videos, and then ‘learn-by-doing’ in class. For more information about the ‘flipping’ concept, check out https://en.wikipedia.org/wiki/Flipped_classroom.

Materials

To learn the basic material, you will read chapters from the e-book YaRrr! The Pirate’s Guide to R. Links to chapters to the book will be posted on the top of this page as the course progresses.

If you are interested in additional, non-piratey materials, there are numerous books and websites that can help you discover new ways of utilizing R. Here are some books I recommend

  1. Data Science with R (online) by Grolemund and Wickham. This is the best book for getting started with R using the ‘tidyverse’ packages. Highly recommended.
  2. Data Visualisation for Social Sciences (online) by Healy.
  3. The R Booky by Crawly.
  4. Discovering Statistics Using R by Field and Miles

Weekly Programming Assignments (WPAs)

During each class you will work on a series of programming tasks called a Weekly Programming Assignment (WPA) together with one or two of your classmates. The questions on WPAs will start easy to help remind you of the reading, but end hard in order to push your knowledge of the material. At the end of class, you will email your work on the WPA to me to receive credit.

The WPAs are designed to be challening. For taht reason, I do not expect you to finish the entire WPA by the end of class. Work hard, ask questions, and complete as many of the problems as you can. The only way to fail your assignment is to not turn it in. You are not expected to continue working on WPAs outside of class. However, each WPA will have a checkpoint to help you know whether you are falling behind or not. If you reach the checkpoint by the end of class, then you are doing just fine. If you do not reach the checkpoint, I strongly encourage you to continue working on the assignment outside of class so that you do not fall behind.

I encourage you to work with a partner (or two) on WPAs. However, it is very important that each student’s work is his/her own. Do not turn in any assignments that you did not contribute to or do not fully understand.

While I will keep track of how often you submit your WPAs, I will not grade them. I will only give you individual feedback if your work looks especially poor, or especially good. Complete answers to WPAs will be posted shortly after each class. It is your responsibility to look over the answers and compare them to your work. Of course, if you have specific questions about the assignment, please email me or come to my office and I will be very happy to help you.

Final Project

At the end of the course you will complete a final analysis project. In this project, you will produce a report containing several key analyses from a dataset of your choosing. If you have a specific dataset you would like to analyze (such as from your thesis), you are welcome to use it. If not, I will assign one to you. I will give you more details about the project later in the course.

Grading

This is a pass / fail course. Passing the course is not difficult. If you work hard, ask lots of questions, turn in your WPAs and complete the final analysis project, you’ll pass the class. If you never ask questions, habitually fail to turn in your WPAs and turn in a poor quality final project, you may fail the course.

Tips

Learning R will be challenging, but it will also be fun (I promise!). In order to learn the most, and have the most fun, I recommend the following

Work together and be noisy in class!

The best way to learn programming is with someone else by your side. For that reason, it should be noisy in class! A quiet class is typically a bored class that isn’t learning anything. A noisy class is a class that’s struggling, asking questions, and actually learning. If I find that the class is not noisy enough, I reserve the right to play Justin Bieber until the class gets noisy again. This is not an empty threat.

Use Google…the right way

If you have a programming problem that you can’t figure out the answer to, don’t be afraid to Google it. I Google programming questions all the time. However, if you don’t understand the answer you find, make sure to ask for help before you include it in your assignment. If you just copy and paste code that you don’t understand, you won’t learn anything.