Introductory R for Social Sciences

Academic Year 24/25 Term 2 (Jan - Feb)

Welcome!

This site serves as a repository for the slides and codes developed for the ‘Introductory R for Social Sciences’ workshop tailored for undergraduate students at SMU. Comprising five sessions, this resource is designed for individuals with fundamental statistics knowledge who are venturing into R programming or coding for the first time.

Instructor

Instructor: Bella Ratmelia, Senior Librarian, Research & Data Services, SMU Libraries

Teaching Assistant: Hector Tan Kheng Wee, SCIS MITB Postgraduate Student

Schedule

Venue : YPHSL seminar room 3.1

Time : 3:30 - 5:30 PM (All sessions)

Click on the link under “Topic” to access the slides. Slides will be progressively made available throughout the sessions.

Session Date Topic Desccription
~ Before the workshop Preparation Complete the Pre-workshop activities
1 Fri, 17 Jan 2025 Introduction to R and RStudio Learn about setting up RStudio, basic data types and structures in R, and importing data files.
2 Fri, 24 Jan 2025 Data wrangling with tidyverse Learn about manipulating data with tidyverse, including filtering, selecting, mutating, and grouping data.
3 Fri, 31 Jan 2025 Data visualization and Descriptive Statistics Learn about creating visualizations with ggplot2 and calculating descriptive statistics like means.
4 Fri, 7 Feb 2025 Basic Inferential Tests Learn about conducting t-tests, chi-square tests, ANOVA, and interpreting statistical results in R.
5 Fri, 14 Feb 2025 Regression and Introduction to Quarto Learn about correlation, regression, and Quarto for creating dynamic, reproducible R documents.
~ After the workshop Post-workshop exercises

Pre-workshop activities

About R and RStudio

R and RStudio are two different but complementary tools used in data analysis and statistical computing. Understanding the difference between them is crucial (especially for beginners).

R is a programming language and software environment specifically designed for statistical computing and graphics. It’s the core tool that actually processes your data and performs analyses.

RStudio is an Integrated Development Environment (IDE) for R. Think of it as a user-friendly interface that makes it easier to write R code, manage projects, and visualize output. RStudio is not required to use R, but it significantly enhances the R programming experience!

Important

Always install R before installing RStudio, as RStudio requires R to function.

Step 1: Install R

  1. Go to https://cran.rstudio.com/

  2. Choose your operating system (Windows, Mac, or Linux)

  3. Download and install the latest version of R

Step 2: Install RStudio

  1. Visit https://posit.co/download/rstudio-desktop/

  2. Scroll down to “Download RStudio Desktop”

  3. Click “Download” and install the latest version of RStudio

Step 3: Install the required packages

Note

Packages in R are collections of additional tools, functions, and datasets that extend R’s capabilities. Packages are created by contributors in the R community.

Think of R as a smartphone, and packages as apps you download to add new features. Each package is designed to help with specific tasks or analyses, like creating graphs, analyzing particular types of data, or performing advanced statistical tests.

Packages can save us time and leverage expert-created tools without having to write complex code from scratch. It’s very handy!

  1. Open RStudio

  2. Copy the following code: install.packages(c( "car", "rmarkdown", "huxtable", "gt", "apaTables", "tidyverse"))

  3. Paste it in the Console tab (see image below)

  4. Press Enter. Rstudio should proceed with installing the packages that we need.

Step 4: Complete the pre-workshop survey

Please complete the pre-workshop survey here to share your goals and current knowledge. Your input will help to tailor the workshop contents and pace.