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

From |
David Airey <david.airey@vanderbilt.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Invoking R from Stata |

Date |
Mon, 1 Dec 2008 19:29:30 -0600 |

Works for me. Thanks Kit and Mike. -Dave On Dec 1, 2008, at 6:45 PM, Michael Hanson wrote:

While I'm on the topic of platform independence....I noticed from -help rsource- that the "Rterm_path" global macro ofRoger Newson's -rsource- procedure defaults to a value of"Rterm.exe". In light of Kit Baum's response to David Airey (quotedbelow), it seems that a more robust solution would be to replacelines 30-32 of rsource.ado:if `"`rpath'"'=="" {; local rpath "Rterm.exe"; }; with the following: if `"`rpath'"'=="" {; if c(os) == "Windows" {; local rpath "Rterm.exe"; }; else {; local rpath "/usr/bin/r"; }; };If I understand Kit's message correctly, the latter executable pathis valid for any Unix-based installation of R (including R.app onMac OS X).Hope this helps, MikeOn Dec 1, 2008, at 6:08 PM, Kit Baum wrote: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 ----- 2+2 q() ----- . 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.RNo doubt by changing the Rterm_options you can alter the way inwhich it produces output. Note that under *nix there is noseparate executable Rterm; it is just the binary executable r.When you install R on Mac OS X, you get R.app, which is theexecutable that provides the GUI, but under the hood it calls /usr/bin/r.Kit Baum, Boston College Economics and DIW Berlin http://ideas.repec.org/e/pba1.html An Introduction to Modern Econometrics Using Stata: http://www.stata-press.com/books/imeus.htmlOn Dec 1, 2008, at 5:29 PM, David Airey wrote:Has anyone used _rsource_ with the Apple OS X operating system? -Dave On Dec 1, 2008, at 1:00 PM, Martin Weiss wrote:Line for the server...That is exactly what -rsource- does, but it also takes care oflogging...HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of OrvalhoAugustoSent: Monday, December 01, 2008 7:56 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: RE: Invoking R from Stata Run from stata: ! /path/to/R.exe /path/to/rscriptfile ! means to invoke a shel command. Caveman On 12/1/08, Martin Weiss <martin.weiss1@gmx.de> wrote:Line for the server... *********** ssc d rsource *********** HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ljubica Nedelkoska Sent: Monday, December 01, 2008 4:38 PM To: statalist@hsphsun2.harvard.edu Subject: st: Invoking R from Stata Dear Statlist members,I would like to run a file written in R program from a Stata dofile. Iwould appreciate if somebody helps me how to invoke R from Stata. Many thanks! Ljubica Ljubica Nedelkoska PhD student Research group: "Economics of Innovative Change" Friedrich Schiller Universität-Jena +49(0)3641 (9) 43 272* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Invoking R from Stata***From:*Ljubica Nedelkoska <Ljubica.Nedelkoska@uni-jena.de>

**Re: st: RE: Invoking R from Stata***From:*"Orvalho Augusto" <orvaquim@gmail.com>

**Re: st: RE: Invoking R from Stata***From:*David Airey <david.airey@Vanderbilt.Edu>

**Re: st: RE: Invoking R from Stata***From:*Michael Hanson <mshanson@mac.com>

- Prev by Date:
**Re: st: RE: Invoking R from Stata** - Next by Date:
**re: st: re: invoking R from Stata** - Previous by thread:
**Re: st: RE: Invoking R from Stata** - Next by thread:
**Re: st: Inefficiency Models in Stata** - Index(es):

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