# R for Psychological Research, Lesson 4: Load data
# 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.


# ---- Where R looks ----

getwd()


# ---- Load a CSV file ----

library(tidyverse)
students <- read_csv("data/students.csv")


# ---- Look at the data ----

students

glimpse(students)


# ---- Excel and SPSS files ----

library(readxl)
students_xl <- read_excel("data/students.xlsx")

library(haven)
students_sav <- read_sav("data/students.sav")
head(students_sav$LearningStyle)

head(as_factor(students_sav$LearningStyle))
