Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling Stata Functions from R

Tags:

r

stata

Is it possible to call Stata functions from R?

like image 501
fgregg Avatar asked Nov 12 '10 16:11

fgregg


People also ask

How do you open Stata do-file in R?

To open a Stata file in R you can use the read_dta() function from the library called haven.

Is R similar to Stata?

R and Stata are very different with regard to storing, accessing, and modifying data and variables. Stata only loads one data set at a time. R stores all object including data as objects and can have an arbitrary number loaded at once. Below I create an interaction term between x and z and a discrete version of x .

What does R n do in Stata?

return add copies everything new in r() into return(). Say that your program performed a summarize. return add lets you add everything just returned by summarize to the to-be- returned results of your program. If your program had already set return(N), summarize's r(N) would not replace the previously set result.

Is Stata easy to use?

Stata is both easy to learn and also very powerful. Stata is easy to learn in two ways. First, it offers a point-and-click interface that you can use if you do not know the name of a command, or the particulars of using it.


1 Answers

Not directly, i.e. there is no package I am aware of that implements a bridge.

You can always call external programs using system() but that is neither elegant nor efficient. That said, you could prepare data in R, write it out, call Stata and then read the results in; see help(system).

like image 77
Dirk Eddelbuettel Avatar answered Oct 05 '22 06:10

Dirk Eddelbuettel