[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: st: re: invoking R from Stata

From   Kit Baum <>
Subject   re: st: re: invoking R from Stata
Date   Mon, 1 Dec 2008 18:08:34 -0500

< >	
Dave asked

Has anyone used _rsource_ with the Apple OS X operating system?

He is referring to Roger Newson's -rsource- package on SSC.

I just tried it under Mac OS X 10.5 and it works fine. In Stata, do

global Rterm_path "/usr/bin/r"
global Rterm_options `"--vanilla"'

Then if we have a file test.R containing


. rsource using test.R
Assumed R program path: "/usr/bin/r"

Beginning of R output from source file: test.R

R version 2.6.2 (2008-02-08)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 2+2
[1] 4
> q()

End of R output from source file: test.R

No doubt by changing the Rterm_options you can alter the way in which it produces output. Note that under *nix there is no separate executable Rterm; it is just the binary executable r. When you install R on Mac OS X, you get, which is the executable that provides the GUI, but under the hood it calls /usr/bin/r.

Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index