1 Read data

We have these files: - cholest.csv - cholest.sav - cholest.dta - cholest.xlsx

*Always make sure that you set the working directory first!

data.csv = read.csv("cholest.csv")  #most natural way to open data in R
data.csv
library(foreign)  #library to read .sav (SPSS) and .dta (STATA) files
data.sav = read.spss("cholest.sav", to.data.frame = TRUE)  #SPSS
data.sav