Introduction to R and Rstudio

Lecturer: Peter Gruber

Modality: Online

Preliminary workshop: 6-7 August 2026

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 for students to use R for data analytics tasks, They also learn how to 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.

 

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.

Assessment is carried out via guided online exercises and small projects. Grading is pass/fail. Students can work on the assessments on their own schedule in the 9 days after the end of the bootcamp. The time needed for these assessments is approx. 2 hours.

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 group feedback

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, concrete copilots: ChatGPT, Github Copilot, Google Gemini
  3. Importing and organizing data
    File formats, importing data, R data.frames and other data structures, summary statistics
  4. True or false
    Formulating conditions via logical operators and logical variables
  5. Importing data
    CSV files, APIs, using and installing packages, introductory scraping
  6. Data operations
    Subsetting, partitioning, reshaping and merging datasets
  7. Simple linear models
    A simple linear regression model: set up, results, interpretation
  8. Graphics
    Simple graphs, creating a report in Rmarkdown

 

Prerequisites

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

Computing requirements: 

  • Participants are expected to bring their laptop with R and Rstudio installed. A detailed installation instruction will be provided.
  • They also need a free ChatGPT account and a free Google account (e.g. Gmail).

Peter Gruber

Faculty of Economics, Università della Svizzera italiana, Switzerland

Peter Gruber has a PhD in Physics from TU Wien and a PhD in Finance from the Università della Svizzera italiana. He has joined USI in 2008. His research interests include the economics of volatility, econometrics with non-standard data sets and high performance computing. Dr. Gruber teaches numerical methods with MATLAB and R at USI and in St. Gallen.

Read