Coordinates
This is the online syllabus for the course Basic data and decision analysis in R,
taught at the University of Konstanz in Winter 2017/2018. Coordinates:
- What: Basic data and decision analysis in R (PSY-12560, ZEuS)
- When: Mondays, 13:30–15:00
- Where to be: Room D247
Who: Hansjörg Neth, Office D507, h.neth@uni-konstanz.de
- Online resources:
- Read the YaRrr ebook;
- Get information and WPAs at Rpubs/Rtudes and Rpository.com;
- Post your work at Ilias.
- Read the YaRrr ebook;
Schedule, Topics and Assignments
Week | Date | Topic | Reading (before class) |
WPAs (in/after class) |
---|---|---|---|---|
Start: | 23.10.2017 | Introduction: Getting started | Yarrr 1–3 | WPA 00 |
1. | 30.10.2017 | Basics: Scalars and vectors |
Yarrr 4+5 |
WPA 01 |
2. | 06.11.2017 | Vector functions, indexing vectors | Yarrr 6+7 | WPA 02 |
3. | 13.11.2017 | Matrices and data frames, managing data and workspace |
Yarrr 8+9 |
WPA 03 |
4. | 20.11.2017 | Advanced data frame manipulation | Yarrr 10 | WPA 04 |
5. | 27.11.2017 | Graphics: Basic plotting, color management and plotting parameters |
Yarrr 11+12 |
WPA 05 |
6. | 04.12.2017 | Statistics: (a) 1- and 2-sample null-hypothesis testing |
Yarrr 13 |
WPA 06 |
7. | 11.12.2017 | (b) ANOVAs | Yarrr 14 | WPA 07 |
8. | 18.12.2017 | (c) Linear regression | Yarrr 15 | WPA 08 |
9. | 08.01.2018 | Customization and control: Writing functions and loops |
Yarrr 16+17 |
WPA 09 |
10. | 15.01.2018 | Packages: (a) Data cleaning and wrangling |
tidyr documentation |
WPA 10 |
11. | 22.01.2018 | (b) Classification decisions with fast and frugal trees (FFTs) |
FFTrees article and documentation |
WPA 11 |
12. | 29.01.2018 | Final project 1 | – | – |
13. | 05.02.2018 | Final project 2 | – | – |
14. | 12.02.2018 | Final project 3 | – | – |
End: | 15.03.2018 | Final project to be submitted to Ilias. | – | – |
Course Description
Goal
This course will introduce the basics of the R software environment for statistical computing and then use R as a tool to solve interesting problems in the psychology of judgment and decision making. Its main goal is to transform your from an R enthusiast into an R user.1
Structure
The course is structured into three parts:
Learn R: We will first explore various software products (including R, RStudio, R Markdown or LaTeX) and spend several sessions to familiarize ourselves with R’s essential functionality, ranging from basic data structures to analyzing, generating and visualizing data.
Applying R: Having covered the basic notions of R, we will apply R as an analytical and experimental tool to analyze various data sets and explore more advanced R packages, including the performance of simple heuristics for rapid and robust classification decisions.
Using R: In the final sessions, students will use R to collect or generate, analyse, and present data on a project of their choice, which can (but does not have to) prepare for or be linked to a BSc, MSc, or PhD thesis.
Audience
This course is for anyone who wants to learn and use R to solve data-related problems in psychology or related academic disciplines. It is suited for beginners, but not (primarily) on statistics. Previous programming experience is helpful, but not necessary. If you have never written code before, you should have a healthy enthusiasm for trying out new technologies and for solving data-related puzzles. As we will begin with the basics, you will quickly see that methods of data wrangling are useful for most areas of psychology and beyond. Thus, just come with an open mind and prepare for having fun with data!
Materials
Readings and WPAs
All materials needed for this course will be available online and posted or linked at Rpository.com:
For most of this course, we will work through Nathaniel Phillips’ wonderful e-book Yarrr! The Pirate’s Guide to R, which is both funny and informative. Truly devoted pirates may also watch the video lectures on Yarrr’s Youtube channel.
In later sessions, we may use some more specialized articles (which will be referenced in this document).
Additional course materials (like this syllabus) and weekly programming assignments (WPAs) are linked at Rpository.com and posted at Rpubs/Rtudes.
Hardware
Room D247 is a regular seminar room, not a computer lab. Hence, you will need to find a suitable computer to practice throughout the week and bring your own laptop to work in class. As we will typically work in groups of 3 or 4 students, not everyone needs to bring their own machine.
Software
To use R on your own machine, you should install recent versions of:
- the R software environment;
- the RStudio IDE (the “Desktop” version);
- the
rmarkdown
andyarrr
packages2 by running the following code:
install.packages("rmarkdown") # installs a package
library("rmarkdown") # loads a package
install.packages("yarrr")
library("yarrr")
Course Concept
Premises
This is not a typical course — it is probably both more challenging and more rewarding than most of your other courses (at least the ones I’m familiar with). Importantly, this course is based on the assumption that you chose to attend, are eager to learn, and willing and able to invest the effort required to succeed in it. Instead of needing to be controlled or disciplined, I trust that you share the basic goals of the class and will manage your time responsibly. This includes that you regularly attend class, turn in your assignments in time, cooperate with your classmates, and respect their different needs and styles.
Session Structure
This course mixes traditional instruction with the paradigm of the tilted classroom:
Up to 30 minutes: To start each weekly session, the instructor introduces the current topic and discusses its main concepts or commands. (This part is new and should allow students to address difficulties encountered during class preparation. It does not try to cover everything or replace the weekly preparation.)
Approx. 60 minutes: The remainder of the course uses the so-called flipped classroom paradigm, in which students are solving WPAs — individually, in pairs, or in small groups — with optional guidance by the instructor (see Wikipedia for details).
Rules
The following rules apply:
You should always be prepared when arriving in class. This includes reading the text of the current topic, bringing questions on what you did not understand, and downloading the current WPA which will be available a few hours prior to class.
It should be noisy in the flipped part of each session. Unless you’re watching a movie or writing an exam, a quiet class mostly indicates a bored class that isn’t learning anything. Thus, rather than calmly accumulating lines of code, you are expected to exchange, discuss, question and revise your solutions in class. However, mobile phones and any other non-course-related activities — like emailing, web-surfing, etc. — are not allowed in class.
Classes end at 15:00 with a tidy and intact seminar room. Please rearrange chairs and tables to their original state.
To learn R, you have to follow these rules and do three things: Practice, practice, and get help — from your peers, the instructor, books or online sources — when you are stuck. Even though you may mostly want to learn and practice R by yourself, it is in your best interest to regularly attend class and exchange your solutions with your peers. If you repeatedly miss class or fail to turn in WPAs without a valid excuse, you won’t learn, and you may fail the course.
Requirements
A. Weekly readings
To make our sessions successful and enjoyable, you need to arrive prepared for every class. Your weekly reading must be completed in advance of every class and consists in actively reading the corresponding materials.
B. Weekly programming assignments (WPAs)
In every regular class, you receive a weekly programming assignment (WPA) which is to be started in class and submitted to Ilias by Wednesday of the same week (before 23:59).
Your initial WPAs can be submitted as scripts of (tidy and commented) code (as
.R
or.Rmd
files). After the introduction to R Markdown your WPAs should be reproducible documents that combine text and code (in.html
or.pdf
formats).Please ensure that every file you submit states the current assignment (e.g., WPA03), your name, and the current date at the top of the document and is named as
LastnameFirstname_WPA##_yymmdd.ext
.3
C. Final project
The last sessions of the course are devoted to developing a final project of your choice. This project can be on any topic, but your ideas for final projects should be coordinated with the instructor. Your final project should include
- some data,
- some computation/data manipulation, and
- some visualization of your data or results.
All files comprising your final project should be submitted as a zipped archive (entitled LastnameFirstname_finalProject.zip
) to a corresponding Ilias folder. Although final projects can be completed during the final sessions, they may be submitted after the end of classes, but no later than March 15, 2018.
Grading
A prerequisite of passing this course is that you regularly attend and contribute to class.
Your final grade will be determined on the basis of two components:
- Completeness, timeliness, and quality of your WPAs;
- Completeness, timeliness, and quality of your final project.
If you are attending this course at the undergraduate level (for 3 credits), both components will be weighted equally (50:50) in your final grade. If you are attending this course at the postgraduate/PhD candidate level (for 6 credits), your final project should be more extensive and counts twice as much (66%) towards your final grade.
Links
Here is a summary of course-related links:
Link | Description |
---|---|
uni.kn: | Basic data and decision analysis in R: |
ZEuS | ZEuS entry of this course |
Ilias | Ilias group of this course |
Rpository.com | Online resources on R and this course |
Rpubs/Rtudes | Current syllabus and programming assignments (WPAs) |
Yarrr: | |
Yarrr! The Pirate’s Guide to R | Nathaniel Phillips’ manual for aspiring pirates |
Yarrr Chapter Exercise Solutions | Solutions to the end of chapter Test Your R Might! exercises |
Yarrr’s Youtube channel | in case you prefer watching to reading |
Reference: | |
R reference card | R reference card by Tom Short |
R Studio cheatsheets | Handy cheatsheets by the R Studio folks |
RMarkdown reference card | A handy RMarkdown guide |
Basic RMarkdown.html | .html -output of a RMarkdown template |
Basic RMarkdown.Rmd | The .Rmd -source of the RMarkdown template |
WPA template.Rmd | A simpler .Rmd -template for your WPAs |
[syllabus.Rmd
updated on 2018-01-22 16:46:02 by hn.]
Viewing R as a tool or method also illustrates that ‘Getting good at R’ would be a rather myopic goal. Once you master R’s basic concepts, you will mostly get better by using R.↩
Packages are chunks of R code and data that can be installed from a nearby CRAN server (while connected to the web). For anything more complex than a simple script, packages are the fundamental unit to share code in R.↩
A simple
.Rmd
template for your WPAs is provided here. A more extensive introduction to R Markdown is available here and the corresponding.Rmd
source is available here.↩