Skip to content

Conversions from Stata to R (and vice versa)

Notifications You must be signed in to change notification settings

guhjy/ipz-stata2r

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stata to R (and vice versa) conversion

This project aims to provide simple code fragments for everyday data analysis tasks in Stata and in R. The ultimate goal is to make conversion between the two software packages easier.

The inspiration for this project is the Data Analysis Examples website made by the Statistical Consulting Group at UCLA.

Structure and naming conventions

The tasks are structured in the following four categories:

  1. Reading/writing data
  2. Data munging (recoding/cleaning)
  3. Computing statistical models
  4. Presenting results

There is a "standalone" and a "short" example for each task. The standalone example contains all the necessary commands to run the example (reading data, loading addons, etc.). The short example is just the code for the specific task (the standalone code without preparatory/unrelated steps).

The standalone code can be in the Rmd format. This allows for nicer explanations of what the code does than comments in the script files.

The file naming follows the scheme:

  • adding-vars.{do,md}
  • adding-vars-short.do
  • adding-vars.{r,Rmd}
  • addings-vars-short.r

Data

The data on European Representative Democracies that is used in all the examples is compiled and kindly made available by Staffan Andersson, Torbjörn Bergman and Svante Ersson. The full citation is:

Andersson, Staffan; Bergman, Torbjörn & Ersson, Svante (2012). “The European Representative Democracy Data Archive”. Main sponsor: Riksbankens Jubileumsfond (In2007-0149:1-E). Principal investigator: Torbjörn Bergman. [www.erdda.se]

We have made some preliminary data cleaning steps mainly annotating variables with their names from the codebook. The relevant scripts are in the data-prep folder.

Authors

Code was either written by Marco Steenbergen or by Christian Müller. Christian Müller maintains the git repository.

Similar projects

Licensing

The data files are copyright (c) 2012-2013 by Staffan Andersson, Torbjörn Bergman and Svante Ersson. They may only be redistributed under the terms specified at erdda.se.

All code that is written for this project is licensed under the CC-BY licence:

Creative Commons Licence
stata2r by Marco Steenbergen and Christian Müller is licensed under a Creative Commons Attribution 3.0 Unported License.

About

Conversions from Stata to R (and vice versa)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • R 71.4%
  • Stata 28.6%