(1) R Kickstart and Data Import – Presentation

Module 1 Presentation: R Kickstart and Data Import

This module is designed for complete beginners. By the end, you will understand what R and RStudio are, how scripts run, how files are organized, and how to import your first dataset safely.

Beginner outcome: you will be able to open RStudio, create a project, run simple commands, and import a CSV without panic.

1) What is R and what is RStudio?

  • R is the programming language that does the calculations.
  • RStudio is the interface where you write and run R code.
  • You can think of it as: R = engine, RStudio = dashboard.

2) The 4 key windows in RStudio

  • Script: where you write code that can be saved and reused.
  • Console: where code executes immediately.
  • Environment: shows objects currently in memory.
  • Files/Plots/Packages/Help: navigation, output, and documentation.

3) Project setup (do this every time)

  1. File -> New Project -> New Directory -> New Project.
  2. Name it microSOS-workshop and choose a known folder.
  3. Create subfolders: data, scripts, output.
  4. Save your first script as scripts/module1_intro.R.
Why this matters: most beginner frustration comes from files living in random locations. Projects keep paths stable.

4) First commands and what they mean

# Arithmetic
2 + 2

# Create objects with <-
site_name <- "MicroSOS"
participants <- 24

# Inspect objects
site_name
participants

# Get help
?mean

5) Importing your first CSV safely

  1. Put your CSV file in data/.
  2. Use:
my_data <- read.csv("data/my_file.csv", stringsAsFactors = FALSE)
str(my_data)
head(my_data)
summary(my_data)
Success check: if str(my_data) runs and columns look correct, your import worked.

6) Common beginner errors and fixes

  • "object not found": run the line that creates the object first.
  • "cannot open file": confirm file name/path and project folder.
  • Red error text: read the final line carefully; it usually tells exactly where the issue is.