(1) R Kickstart and Data Import – Practical

(1) R Kickstart and Data Import – Practical

Interactive step-by-step mode: complete each step checkbox to unlock the next step.

Step 1 / 6

Step 1: Create your project

Open RStudio, create project microSOS-workshop, then create folders.

dir.create("data", showWarnings = FALSE)
dir.create("scripts", showWarnings = FALSE)
dir.create("output", showWarnings = FALSE)
getwd()

Step 2: Run first commands

Confirm commands execute and variables are stored.

2 + 2
name <- "your_name"
name

Step 3: Build sample data

Create a small table by hand.

demo <- data.frame(
  plant_id = 1:5,
  treatment = c("Control","Treatment","Treatment","Control","Control"),
  height_cm = c(12.1,13.5,14.0,11.8,12.4)
)

Step 4: Save and re-import CSV

Export the file to data folder and read it again.

write.csv(demo, "data/demo_plants.csv", row.names = FALSE)
plants <- read.csv("data/demo_plants.csv", stringsAsFactors = FALSE)

Step 5: Inspect imported data

Check structure and summary.

str(plants)
head(plants)
summary(plants)

Step 6: Write notes

Document what worked and what confused you.

# Notes
# - Import worked
# - Columns look correct
# - Questions for trainer
Great work. You completed all steps in this practical.