How to get your data into R

Once your R system is ready, the first important step is to get your data into R. The best way to read any proprietary data (e.g., SPSS, SAS, Stata, systat) into R is to open the data in its original program and export it as a .csv file. In almost all cases, the original program is better at converting it to .csv than R is at converting the original file formats. R has dedicated functions to read .csv files:

myData <- read.csv("/path/to/mydata/myData/data.csv", header = TRUE, sep = " ")

When the first row of the dataset contains the variable names, the option header should be set to TRUE. The sep argument sets the delimiter, which is a blank space by default. Other (arbitrary) delimiters can of course be used (e.g., sep = ";" for the semicolon delimited data file. More information can be found in R by typing:


If you want to directly import proprietary data into R, then more information can be found here: