Data Visualization and Analysis in R (PSY VIZ)

Fall 2024

Published

September 2, 2024

Course Number Time Location Office Hours
PSY VIZ Th, 13:30-15:30 RKC 200 M/Th or by appointment

Make an appointment to come to my office hours. The instructor’s office hours are as follows (or by appointment):

This course does not fulfill distributional requirements. It will receive 2 credit hours. You should plan to complete work during our two-hour meetings each week, as well as reviewing material, completing readings, and completing assignments between meetings.

Wherever possible, I hope to work to make this course accessible and approachable for all students. For more information on accessibility for this course, please view the section on that subject below.

Overview

In this course, students will learn to use the R statistical programming language for data visualization. Weekly meetings will involve discussion of empirical articles in [clinical] psychology and practice/instruction in programming and data visualizations.

This course is intended to follow an introductory statistics course (e.g., PSY 202).

Class assignments will involve implementation of tasks, discussion and analysis of empirical articles, and presentation of proposals. A final presentation will cap each semester.

Specifically, I encourage students in this class to work on projects relevant to understanding the relationship between mood and cognition. Students will take turns presenting relevant empirical articles.

The research discussed in this course may cover topics that are sensitive or personal for many students. If something discussed in class leaves you feeling upset, please speak to a trusted person about your experience. Further, if you find that you are struggling to cope with some of the topics discussed in class, you may contact Bard Counseling Services, and make an appointment; you may also email or call 845-758-7433.

In the spirit of truth and equity, it is with gratitude and humility that we acknowledge that this class will take place on the sacred homelands of the Munsee and Muhheaconneok people, who are the original stewards of this land. Today, due to forced removal, the community resides in Northeast Wisconsin and is known as the Stockbridge-Munsee Community. We honor and pay respect to their ancestors past and present, as well as to future generations and we recognize their continuing presence in their homelands. We understand that our acknowledgment requires those of us who are settlers to recognize our own place in and responsibilities towards addressing inequity, and that this ongoing and challenging work requires that we commit to real engagement with the Munsee and Mohican communities to build an inclusive and equitable space for all.

Objectives

By the end of the course you should…

  • Understand the principles of data visualization and design
  • Be able to evaluate data visualizations and methods of graphing
  • Have gained an ability to read and write code written in the R programming language
  • Know how to create well-designed data visualizations in R

Learning to write code is often difficult. Getting help—and learning how to ask for help—is part of the experience. Take advantage of our small class setting.

Instructor

The instructor for this course is Associate Professor of Psychology Justin Dainer-Best. In person or via email, you can refer to me as Justin or as Professor Dainer-Best (or Dr. Dainer-Best); I use he/him pronouns.

Materials

All materials for this course are available for free, either through links on this syllabus or as uploaded to Brightspace.

Books

We’ll be using readings from the following books. All are available online for free (and linked to in the schedule and references list below), but you may certainly purchase paper copies as desired.

Software

In order to participate in this course, you will need to use R, an open-source (and free) statistical programming language. During or before our first class, you should follow instructions to instal R and RStudio on your personal computer (my recommendation). If you do not have access to a personal computer that will allow you to install this software, you may choose to make a (free) account on https://posit.cloud/, which is a website that runs this software. You can save files, install packages, and download/upload your assignments.

Posit’s RStudio Cloud is not perfect; I recommend using a permanent version of the software if possible.

Installing R and RStudio on your own computer

Most students will want to install R on their personal machines. Follow these instructions to do so.

  1. Install R from https://cran.r-project.org/—it is available for Mac OS, Windows, and Linux. Choose the appropriate link, download, and install.

  2. Install RStudio from https://posit.co/download/rstudio-desktop/—choose the free “RStudio Desktop”. You can run R without RStudio—this is technically an option for all students in this class—but all instructions and examples will expect that you are using RStudio.

Some of the things we will do this semester could be done with Jamovi. You may use it if you would like to.

Class Policies

Attendance

We will move at a rapid pace; material that is missed due to absence will not be repeated in class or office hours. Our classes are designed as interactive, and your absence will impact both your own understanding and the class or your group. Missing multiple days, especially in a once-weekly class, may impact your grade unless we have discussed this in advance.

However, this is a college class and you are an adult; your attendance is your decision. Late arrivals can be disruptive to the class. Consistent patterns of lateness are unfair to other students. Please be on time.

If you are not feeling well, please do not come to class. If you have recently been ill, please wear a mask when you attend; masks are effective at reducing spread of many respiratory illnesses. Each of us shares responsibility for the health and safety of all in the classroom.

Accommodations & Accessibility

Bard College is committed to providing equal access to all students. If you anticipate issues related to the format or requirements of this course, please contact me so that we can arrange to discuss. I would like us to discuss ways to ensure your full participation in the course. Together we can plan how best to support your learning and coordinate your accommodations. Students who have already been approved to receive academic accommodations through disability services should share their accommodation letter with me and make arrangements to meet as soon as possible.

If you have a learning difference or disability that may relate to your ability to fully participate in this class, but have not yet met with the Disability Support Coordinator at Bard, you can contact their office through https://www.bard.edu/accessibility/students/; the Coordinator will confidentially discuss the process to establish reasonable accommodations.

I am available for meetings online as well as those in person.

Diversity, Equity, & Inclusion

It is important to me that this course provides an open and supportive learning environment for all students. I invite you to speak with me if you have concerns or questions regarding issues of belonging, safety, or equity in the classroom. I want our discussions to be respectful of all students. If I am not helping the classroom to feel like an inclusive environment, I invite you to provide me with [anonymous] feedback.

Plagiarism and Academic Integrity

I expect you to be familiar with what plagiarism is and is not. You may not present someone else’s work as your own without proper citation. You may not copy someone else’s work or use AI-generated text. You may not simply reword text from another source without giving credit. Please cite others’ work where relevant, and use your own writing. If you are not sure about the definition of plagiarism, or whether something constitutes plagiarism, please consult with me or with someone at Bard’s Learning Commons. Students caught plagiarizing will be reported to the Academic Judiciary Board, will get no credit for the assignment, and may fail the course.

I operate from the standpoint that you are interested in learning this material, and are doing your best to operate with integrity. Do your best to learn from the assignments in this class.

Do note that in this class, there may in fact be times when it is worthwhile to use generative AI such as chatGPT to help you to write (or understand) code. However, I recommend doing this to help you understand (or to repeat boring repetitive tasks), not to replace learning to write code yourself. These generative intelligences frequently make it difficult to discover the full picture.

Late Assignments

There are no late assignments in this course—with the exception of your need to complete all assignments by the last day of the semester. On days when you are called upon to present, you should plan to be prepared.

Grades

Assignment Points
Code reviews 40
Participation 20
Mid-semester project 20
Final poster 20
Total 100

Many aspects of this class will be graded on a pass/fail basis. However, I recognize that you may not wish to take this class as a P/D/F class—and as such, there are some assignments that will be graded (the mid-semester project and the final poster). Other assignments will receive full points if completed adequately. All assignments are due by the end of the semester.

Assignments

Code review

You will, on most weeks of class, submit R Markdown files and their output for review. (Output may be as HTML or PDFs, but I would also like to see the Rmd files if there are problems.) Where you are unable to accomplish part of the assignment, turning in your code will help me to give you feedback. (In other words, as we’ll discuss, you should always set echo=TRUE in your code chunks.)

Mid-semester project

You will be tasked with creating visualizations for data you are given and explaining what you’re trying to show with those visualizations. The assignment will be provided on Brightspace and you’ll spend most of the class period completing it.

Participation

Participating in class involves being present, asking questions during discussions, and contributing to collaborative projects.

Poster

We will design and build a poster in small groups. Your poster will be graded collaboratively and we will develop a rubric together.

Schedule

Chapters from the books (see books above) are described in the syllabus below. I recommend reading them before the class they are connected to, but you will also refer to them during class.

Day Date   Topic Reading Due
Thursday Sep 5 Introduction, R & RStudio, Directories Syllabus; chapter on installing RStudio (Healy, 2018, Ch. 2)
Thursday Sep 12 Tidy data & the grammar of graphics Learning about tidy data (Wickham et al., 2023, Ch. 5) and ggplot2 (Wickham et al., 2024, Ch. 2)
Thursday Sep 19 Graphic design; R structures Thinking about data viz (Wilke, 2019, Ch. 2) and simple data viz (Chang, 2024, Ch. 2)
Thursday Sep 26 The tidyverse in R
Thursday Oct 3 Types of plots in R; themes Plotting and themes from Healy (2018), Ch. 3 and Wickham et al. (2024) Ch. 17
Thursday Oct 10 Explorations of data in R; mid-semester project
Thursday Oct 17 Problem-solving with R; debugging Mid-semester project
Thursday Oct 24 Plotting t-tests and ANOVA
Thursday Oct 31 Plotting regressions and correlations
Thursday Nov 7 Text, legends, and annotations Wickham et al. (2024), Ch. 8
Thursday Nov 14 Review & catch-up
Thursday Nov 21 Final project planning
Thursday Nov 28 (Thanksgiving: no class)
Thursday Dec 5 (Boards: no class)
Thursday Dec 12 Final project presentation; learning about non-R data viz Poster due
Thursday Dec 19 (Completion week: no class)

References

Chang, W. (2024). R graphics cookbook (2nd ed.). O’Reilly Media. https://r-graphics.org/
Healy, K. (2018). Data visualization: A practical introduction. Princeton University Press. https://socviz.co/index.html
Wickham, H., Çetinkaya-Rundel, M., & Grolemund, G. (2023). R for data science: Import, tidy, transform, visualize, and model data (2nd ed.). O’Reilly Media. https://r4ds.hadley.nz/
Wickham, H., Navarro, D., & Pedersen, T. L. (2024). ggplot2: Elegant graphics for data analysis (3rd ed.). Springer. https://ggplot2-book.org/
Wilke, C. O. (2019). Fundamentals of data visualization. O’Reilly Media. https://clauswilke.com/dataviz/index.html

Reuse

Citation

BibTeX citation:
@online{dainer-best2024,
  author = {Dainer-Best, Justin},
  title = {Data {Visualization} and {Analysis} in {R} {(PSY} {VIZ)}},
  date = {2024-09-02},
  url = {https://faculty.bard.edu/jdainerbest/viz/},
  langid = {en}
}
For attribution, please cite this work as:
Dainer-Best, J. (2024, September 2). Data Visualization and Analysis in R (PSY VIZ). https://faculty.bard.edu/jdainerbest/viz/