The first statistical package I learned how to use was Stata, simply because the classes I was taking were taught using Stata. Stata has served me well over the years, but I'm now slowly making the transition to using the open source language and software environment R. People use R for a variety of reasons, but for me it's a practical choice. I've found that others who are doing similar things as me are using R—example code for techniques I use is often in R, and there are a number of packages in R that make my calculations quicker and easier. If I want to join this community of people, utilize their knowledge, and get help from them, I need to know R.

One of the problems with R is its steep learning curve. The data structures in R can be confusing, especially for Stata users, and the R language resembles computer programming languages, also often intimidating for Stata users. And I don't have the time to muddle through complicated programming languages, I need to get data analyzed! For purely practical reasons I find myself doing things in R if they can't be done in Stata, but falling back on Stata for more simple things like cross tabulations and graphing. I know what takes me thirty seconds in Stata might take me twenty minutes to figure out in R, so I put learning R on the back-burner.

But no longer! I have found a great resource that directly translates Stata commands into R commands: Getting Started in R~Stata (pdf). This manual is simple and infinitely useful—it shows common commands in Stata and R, side by side. If, for example, you want to rename a variable, you know the Stata command is rename, e.g. rename studentstatus status, this manual shows you the R equivalent:mydata <- rename(mydata, c(Student.Status="Status"). You want to summarize your data (the Stata summarize command); the equivalent R command is stat.desc(mydata). It's as easy as that! The manual includes importing data, data manipulation (like renaming variables or generating new variables), descriptive statistics, and some graphing commands. It's a great way to translate knowledge you already have about Stata into R, and you'll find yourself learning about the structure of R along the way. If you're a Stata user and want to learn R, or one of those rare cases of an R user who wants to learn Stata, go download this manual, before it disappears from the web.*

*If you are interested in more systematically learning R—or advancing to more complicated topics—D-Lab offers a variety of workshops on R, from going through the basics for beginners to more advanced topics. There are also R consultants available for specific questions you have. Check out the D-Lab website for information on R workshops and consulting. 

 

Author: 

Laura Nelson

Laura Nelson is a doctoral candidate in sociology. She is interested in applying newly developing techniques in automated text analysis to understand how cultures and logics unify political and social movements. Her current research, funded in part by the NSF, examines these cultures and logics via the long-term development of women's movements in the United States. She is an open-source purist doing her best to eschew proprietary software.