Importing Data Into R

We have to import the data into R before analyzing it. This is usually the first step. One of the best ways to import data into R is haven package.

First, start RStudio. Then type the following (don't forget to replace file location with your own file location).

> library(haven)
> cake <- read_sas("D:\cake.sas7bdat", NULL)

There it is. You just transformed a SAS file to a dataframe object. To view your table, simply type:

> View(cake)