Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Request regarding conversion of Stata code
From
Phil Schumm <[email protected]>
To
<[email protected]>
Subject
Re: st: Request regarding conversion of Stata code
Date
Fri, 31 May 2013 15:55:40 -0500
On May 31, 2013, at 11:40 AM, Michael Stewart <[email protected]> wrote:
> I need to share my Stata code with my colleague who works exclusively with R program. Are there any modules to convert Stata code to R code. Your help is always appreciated.
A one-time (manual) conversion of primarily analytic code (i.e., estimating statistical models) would be fairly straightforward, if you know both Stata and R well enough. Conversion of data management code would also be possible, though because the available data structures, commands and idioms are quite different, this might involve not only translation but also some refactoring (especially if you want to optimize the result). In either case, you would only want to do this once. To be clear about what I am implying, there is no way to do this programmatically, and I very much doubt that such a thing would be possible (except possibly in the simplest of cases, and not without requiring manual cleanup).
I have some experience working on analytic/data management projects which involve multiple languages/software systems. While there are occasionally legitimate reasons to translate code from one language to another, it is typically better to organize the project in a modular fashion so that the task(s) performed in different languages are separate. The different tasks can then be chained together via a build system such as make. The resulting project can be made portable such that it can be worked on by folks who may only be familiar with certain parts, but can still easily (re)generate the project's results. This is a bit more difficult to accomplish if some of your collaborators are using Windows (since tools such as make are more difficult to use there), but it can be done.
In sum, without more information about your particular situation, my suggestion would be to structure your project so that your colleague and easily run your Stata code and obtain the results (i.e., without having to know much at all about Stata), and can contribute to the project in R (of course, this also requires that you be able to run his or her R code, even if you don't know much about R).
-- Phil
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/