# R for Psychological Research, Lesson 3: Tables & packages
# Code from the lesson page, in order. Run it line by line with Ctrl+Enter (Cmd+Enter on a Mac).
# Lines that start with # are comments: R ignores them.


# ---- Data frames: tables ----

students5 <- data.frame(
  ID = c("S001", "S002", "S003", "S004", "S005"),
  Gender = c("Male", "Male", "Female", "Male", "Female"),
  Age = c(20, 21, 19, 19, 21),
  ExamScore = c(73, 75, 52, 43, 88)
)
students5

students5$ExamScore
mean(students5$ExamScore)
students5[2, ]
students5[students5$Gender == "Female", ]
dim(students5)
names(students5)


# ---- Packages: add-ons ----

# (Shown for reference. Remove the # to run it.)
# install.packages(c("tidyverse", "readxl", "haven", "psych", "rstatix", "pwr", "BSDA"))

library(tidyverse)
