PSYC 971
Data Processing and Visualization in R

MWF 10:30-11:20am

Burnett 80

Jeff Stevens (he/him)

Version 2024-03-13

Course description

This course will introduce students to the fundamental concepts and methods used in the R statistical software package (focusing on the tidyverse perspective) to process, visualize, and disseminate data.

Prerequisites

PSYC 350 or equivalent course in introductory research design and analysis. No previous coding experience is required.

Course objectives

  • Learn how to import, process, and plot data in R using tidyverse functions
  • Gain a basic understanding of general programming principles applied to data preparation, analysis, and visualization
  • Apply principles of good data visualization to plot data in an informative way
  • Produce reproducible manuscripts and presentations with R code embedded

Course expectations

The primary aim of this course is to teach you how to use R. Therefore, reading the assigned texts in advance, attending class, and participating in discussions and exercises is integral to this course and expected. Learning R follows the ‘use it or lose it’ mantra. Plan on working on it a little bit almost every day. Please don’t get behind, as we move quickly through the course, and much of what we learn is cumulative.

Student hours

Jeff has time to meet with students Tuesday mornings from 9-10am via Zoom and Wednesday afternoons from 1-2pm in his office at B83 East Stadium (CB3).

In addition to Jeff’s student hours, Quantitative Assistant Katie McNealy is available to help with R-related issues. Katie took the course previously and is proficient in R. Note that she is available for general consultation on topics covered in the course not for specific questions about course requirements or assignments. So you can go to her with general R understanding/debugging issues. She has drop-in hours 1-3pm on Wednesdays and has reservable consultation 10-minute and 30-minute slots available on Wednesday and Thursday afternoons. See the course Canvas resources page for links to her calendar to schedule a time to meet.

Computing requirements

You will need to bring a laptop to class to run in-class coding. While we will not be using very large data sets or running massive computations, having a faster computer will allow you to quickly proceed through the coding. On this laptop, you will need to install R, RStudio, and a number of R packages. Please ensure that your laptop is charged before class.

Readings

This course will draw from a number of resources, primarily:

Other readings are available in the course schedule.

Assignments

Learning journal

As you learn R, you will pick up all kinds of little gems to help you use it. For example, to add the pipe syntax %>% (something you’ll be doing a lot in the tidyverse), you can simply type Ctrl/Cmd-Shift-M. Keep a journal of these little tricks/hints that you are most excited about to submit at the end of the course. I highly recommend posting them on social media throughout the semester.

Exercises

Most class meetings will be followed with sets of exercises to help you practice implementing the concepts discussed. These will be assessed as complete or incomplete.

Check-ins

At the end of each module, there will be a summative assignment over that module’s material.

Projects

The aim of this course is for you to be able to use R to process, visualize, and disseminate your data. Therefore, there will be multiple projects that involve you applying what you learn in class to your own data. The first projects will involve wrangling your data into tidy format and editing values. The next projects will involve plotting and presenting your data.

CReativity

Personally, I find coding in R to be a lot of fun. One way that people have fun in R is to express their creativity. Choose at least one of the following ways to express your creativity in/about R (you’ll receive extra credit if you submit more than one type):

Grades

Grade scale

Grades of C or higher (>= 69.5) count as passing for Pass/No Pass grading.

Assessment

Grade component Grade percentage
Exercises 20
Check-ins 35
Learning journal 5
Projects 35
Creativity 5

Course resources and policies

Instructional continuity plan

If in-person classes are canceled, you will be notified of the instructional continuity plan for this class by email.

Diversity, inclusion, and wellness

We must treat every individual with respect. We are diverse in many ways, and this diversity is fundamental to building and maintaining an equitable and inclusive campus community. Diversity can refer to multiple ways that we identify ourselves, including but not limited to race, color, national origin, language, sex, disability, age, sexual orientation, gender identity, religion, creed, ancestry, belief, veteran status, or genetic information. Each of these diverse identities, along with many others not mentioned here, shape the perspectives that students and faculty bring to our campus. I would like to create a learning environment in this course that supports a diversity of thoughts, perspectives and experiences, and honors participant identities. To help accomplish this:

  • If you have a name and/or set of pronouns that differ from those that appear in your official records, please let me know in the course introduction form.
  • I (like many people) am still in the process of learning about diverse perspectives and identities. If something was said in class (by me or anyone else) that was uninformed or insensitive or made you feel uncomfortable, please feel free to raise the issue in class, contact me to schedule an opportunity to discuss the issue in person, or submit anonymous feedback via the course feedback form. I recognize the power differential between student and professor, but I promise you, neither your grade nor my opinion of you will be impacted by your willingness to bring issues to me.
  • If you feel like your performance in the class is being impacted by your experiences outside of class, please don’t hesitate to talk with me. Your wellness is important to me, and I do not want this course to adversely affect your mental health. I am invested in your understanding of the course material and am happy to make accommodations to achieve the longer-term goal of you learning to use R. Beyond requesting specific accommodations, if you notice something about the class structure or assignments that could be made to improve universal accessibility, please let me know. Sometimes you might be able to work around a barrier, and not go to the trouble of going through the SSD to request a formal accommodation – but over time, working around barriers takes a toll. If I am made aware of those issues, we are better able to remove them so you can focus fully on your work.
  • Unfortunately, incidents of bias or discrimination do occur, whether intentional or unintentional. They contribute to creating an unwelcoming environment for individuals and groups at the university. Therefore, the university encourages anyone who experiences or observes unfair or hostile treatment on the basis of identity to speak out for justice and support, within the moment of the incident or after the incident has passed. As noted above, if this happens in the context of this class, I encourage you to come talk to me so we can figure out together how to address the issue and find you the support you need. At a broader institutional level, resources are available at Title IX Resources and Support and incidents can be reported through the TIPS system.

Resources for students seeking mental health help

UNL offers a variety of options to students to aid them in dealing with stress and adversity. Counseling and Psychological & Services (CAPS) is a multidisciplinary team of psychologists and counselors that works collaboratively with Nebraska students to help them explore their feelings and thoughts and learn helpful ways to improve their mental, psychological and emotional well-being when issues arise. CAPS can be reached by calling 402-472-7450. Big Red Resilience & Well-Being (BRRWB) provides one-on-one well-being coaching to any student who wants to enhance their well-being. Trained well-being coaches help students create and be grateful for positive experiences, practice resilience and self-compassion, and find support as they need it. BRRWB can be reached by calling 402-472-8770.

Accommodations for students with disabilities

The University strives to make all learning experiences as accessible as possible. If you anticipate or experience barriers based on your disability (including mental health, chronic or temporary medical conditions), please let me know immediately so that we can discuss options privately. To establish reasonable accommodations, I may request that you register with Services for Students with Disabilities (SSD). If you are eligible for services and register with their office, make arrangements with me as soon as possible to discuss your accommodations so they can be implemented in a timely manner. SSD contact information: 117 Louise Pound Hall; 402-472-3787.

Class materials use and distribution

Most class materials (anything on this website) are publicly available for anyone to use, assuming they follow the Creative Commons Attribution 4.0 International Public License (CC BY 4.0) as described in the main page of the website. Some assignments are not publicly available.

Academic dishonesty policy

You are responsible for knowing and adhering to the UNL Student Code of Conduct. Any student found guilty of academic dishonesty, including (but not limited to) cheating, falsification, and plagiarism, will fail the course and may be subject to disciplinary sanctions.

  • Cheating: Copying or attempting to copy from an academic test or examination of another student; using or attempting to use unauthorized materials, information, notes, study aids or other devices for an academic test, examination or exercise; engaging or attempting to engage the assistance of another individual in misrepresenting the academic performance of a student; or communication information in an unauthorized manner to another person for an academic test, examination or exercise.
  • Fabrication or Falsification: Falsifying or fabricating any information or citation in any academic exercise, work, speech, research, test or examination. Falsification is the alteration of information, while fabrication is the invention or counterfeiting of information.
  • Plagiarism: Presenting the work of another as one’s own (i.e., without proper acknowledgement of the source) and submitting examination, theses, reports, speeches, drawings, laboratory notes or other academic work in whole or in part as one’s own when such work has been prepared by another person or copied from another person. Materials covered by this prohibition include, but are not limited to, text, video, audio, images, photographs, websites, electronic and online materials, and other intellectual property. Copying material from other sources with minor modifications is considered plagiarism.
  • Complicity in Academic Dishonesty: Helping or attempting to help another student to commit an act of academic dishonesty.
  • Impermissible Collaboration: Collaborating on any academic exercise, work, speech, test or examination unless expressly authorized by the faculty member. It is the obligation of the student to know whether collaboration is permitted.

Course schedule

Note this is tentative!
Week Date Module Topic Readings
0 1 Getting started with R SIDS 1, Wickham 2020
1 2023-01-23 1 Course introduction R4DS2 1
2023-01-25 1 Working in RStudio RYWM 1
2023-01-27 1 Coding basics R4DS2 3, 7.1 - 7.2
2 2023-01-30 1 Workflows R4DS2 9
2023-02-01 1 Literate programming R Markdown, Markdown tutorial
2023-02-03 2 Data types R4DS1 20
3 2023-02-06 2 Data structures PWR 13
2023-02-08 2 Importing data R4DS2 22
2023-02-10 2 Validating data Wikipedia
4 2023-02-13 3 Selecting columns R4DS2 4.3.2 - 4.3.4
2023-02-15 3 Mutating columns R4DS2 4.3.1
2023-02-17 3 Piping commands R4DS2 5
5 2023-02-20 3 Filtering rows R4DS2 4.2
2023-02-22 3 Summarizing rows R4DS2 4.4
2023-02-24 4 Pivoting data R4DS2 6
6 2023-02-27 4 Separating data R4DS1 12.4 - 12.5
2023-03-01 4 Merging columns R4DS2 21.1 - 21.3.2
2023-03-03 4 Merging rows R4DS2 21.3.3 - 21.5
7 2023-03-06 5 Numbers R4DS2 14
2023-03-08 5 Strings R4DS2 15
2023-03-10 5 Matching patterns R4DS2 16
8 2023-03-13 Spring break
2023-03-15 Spring break
2023-03-17 Spring break
9 2023-03-20 5 Factors R4DS2 17,
2023-03-22 5 Dates and times R4DS2 18,
2023-03-24 Project 1
10 2023-03-27 6 Functions R4DS1 19
2023-03-29 6 Iteration R4DS2 27
2023-03-31 7 Grammar of graphics I R4DS2 2, 11
11 2023-04-03 7 Grammar of graphics II FDV 1, 2, 3
2023-04-05 7 Design and themes FDV 17, 25, 26, 29
2023-04-07 7 Color FDV 4, 19, Cookbook for R
12 2023-04-10 8 Plotting distributions: histograms FDV 7
2023-04-12 8 Plotting distributions: boxplots FDV 9
2023-04-14 8 Plotting amounts: bar charts FDV 6
13 2023-04-17 8 Plotting x-y data: associations FDV 12
2023-04-19 8 Plotting x-y data: time series FDV 13, 14
2023-04-21 8 Plotting x-y data: categories Raincloud Plots
14 2023-04-24 9 Adjusting axes FDV 21, 24
2023-04-26 9 Annotating plots FDV 22.1 - 22.2, R4DS2 13
2023-04-28 9 Dealing with overlap FDV 18, 20
15 2023-05-01 9 Plotting challenge
2023-05-03 10 Tables FDV 22.3, RMC 10.1
2023-05-05 10 Publications papaja manual 1
16 2023-05-08 10 Advanced R Markdown R4DS2 30
2023-05-10 10 Quarto Quarto demo slides
2023-05-12 Statistics blitz

FDV = Fundamentals of Data Visualization, R4DS1 = R for Data Science 1st edition, R4DS1 = R for Data Science 2nd edition, PWR = Programming with R, RMC = R Markdown Cookbook, RYWM = RYouWithMe, SIDS = Statistical Inference via Data Science