My last post was regarding the installation of R on Ubuntu. That was not the beginnig though. My curriculum required using Stata, but Linux installer for the same was not available and I did not want to shift to Windows. After a lot of googling stuff, I came to the conclusion that for a beginner in data analytics (like me), it does not matter much what you choose, though R has a steeper learning curve.

So, I decided to move forward with what was possible… installing R.

Now, the problem was, compatibility between R and STATA 13 i.e , how to use datasets generated by/for STATA in R. For STATA 12 and below, R offers an official library called foreign which lets you import STATA datasets in R like this:

library(foreign) data <- read.dta(“filename.dta”)

However, this method will not be supported for STATA 13 and beyond. Luckily, a faculty at RUB has created an open source package that helps to import STATA 13 dataset into R.

To use this, first install devtools package in R Go to console in R and type install.packages(“devtools”, dependencies=T) Then devtools::install_github(“sjewo/readstata13”, ref=”0.4”)

This will install the package in R. Now, in order to use it , you need to import it. library(readstata13)

Then, this will work like a magic!! data <- read.dta13(“filename.dta”)

Cheers!!

UPDATE: I found a useful resource for people who are migrating from STATA to R or vice versa http://www.princeton.edu/~otorres/RStata.pdf