Introduction to R and Rstudio

Lecturer: Peter Gruber.

Modality: Online

Preliminary workshop: 08 - 09 August 2024

This two-day workshop is free of charge for participants of regular workshops (in week 1 or 2) or can be booked by itself for a fee (200 CHF).

 

Workshop contents and objectives

This module is an introduction to the programming language R for students with little or no experience in this language. The goal is to provide the minimal computational foundations so that students can competently use AI programming assistants such as ChatGPT by asking the right questions and assessing the provided answers. A further aim is to set the basis for using R in the specialized courses of the Summer School in Social Science Methods.

After this course, students will be able to set up the Rstudio environment and to use the R language for preparing, cleaning, organizing and merging datasets. They will be able to calculate simple descriptive statistics as well as to formulate and perform basic regression analysis. They will
understand the structure of the R language, empowering them to make informed use of AI copilots such as ChatGPT.

 

Workshop design

The course is organised as a 2-day online bootcamp. On each day, there will be eight teaching units:

  • two teaching units of 1.5hours in the morning
  • two teaching units of 1.5hours in the afternoon
  • Students are expected to complete a 2-hour online tutorial in the week before the beginning of this bootcamp on their individual schedule.

The teaching methodology is based on realistic data sets. Each teaching unit takes students from theory to mastery in five steps:

  1. Lecture with presentation of new concepts
  2. Guided tour of R: students and professor work together on applying the new concept
  3. Short rationalization of the lessons learned using R
  4. Individual exercises with possibility to ask questions
  5. Online quiz with feedback

There is no exam and no grade. A certificate of attendance can be issued upon request.

 

Detailed lecture plan

  1. Getting started and getting organized
    The Rstudio environment, the logic behind R, first steps with R: variables, operators
  2. Talking to AI assistants
    Understanding AI copilots, prompts for programming help, assessing the results
  3. Importing and organizing data
    File formats, R data.frames and other data structures, the read.xxx commands, summary statistics
  4. Extending R
    How to use functions; how to install packages; data import via APIs
  5. Spreading the word
    Simple graphs, creating a report in Rmarkdown and publishing it on the web
  6. True or false
    Formulating conditions via logical operators and logical variables
  7. Working with data
    Subsetting, partitioning, merging and aggregating; applying a function by partition
  8. Simple linear models
    A simple linear regression model: set up, results, interpretation

 

Class materials

All slides, sample programs, sample datasets, prompts and solutions to exercises will be made available digitally. 

Participants are expected to bring their laptop with R and Rstudio installed. A detailed installation instruction will be provided.

Participants also need a free ChatGPT account and a free Google account (e.g. Gmail).

 

Prerequisites

Students are expected to have basic computer and statistics skills. No programming knowledge is required. Students are expected to complete an online tutorial before the beginning of this bootcamp.