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]

From |
Sergiy Radyakin <[email protected]> |

To |
"[email protected]" <[email protected]> |

Subject |
Re: st: User input from shell script |

Date |
Fri, 15 Nov 2013 15:37:54 -0500 |

On Fri, Nov 15, 2013 at 9:28 AM, Thomas, Anthony <[email protected]> wrote: > Thanks Sergei and Roberto, > > These both sound like good ideas. I had hoped there was a way to fool > R into thinking the Stata command line was stdin by redirecting stdin > to the Stata console or by opening a connection directly between R and > Stata. Are either of those possible? A quick look at the manual the short answer is NO. the long answer is, probably, YES. But you would probably need a custom version of R (open source http://cran.r-project.org/sources.html, good luck...) and a custom version of Stata (contact StataCorp regarding NBS). I know people use Stata to perform computations for their program as a library, but not the other way around. Also, if you succeed, you will not only "fool R into thinking..." but also create a lot of confusion among the users: why did my action in one program caused something in another? How do I undo that? What happens if I close one? Best, Sergiy > section on 'Interacting with other programs' leads me to believe no > but I may be missing something. I think passing arguments via a macro > or log file would work also though. Thanks again for your help. > > Best, > > Anthony > > On Thu, Nov 14, 2013 at 7:03 PM, Roberto Ferrer <[email protected]> wrote: >> I'm not sure I understand but can you not have R intermittently >> read/parse a -log- file produced by Stata? >> >> On Thu, Nov 14, 2013 at 5:45 PM, Thomas, Anthony >> <[email protected]> wrote: >>> Hi Statalist, >>> >>> I am trying to write an ado file (Stata 11 for Linux) that calls an R >>> program which requests user input from "stdin" - in this case the >>> system command line. So a simplified example would be: >>> >>> shell Rscript rProgram.r ... >>> >>> The R program will periodically pause and request input from the user >>> before continuing. For those familiar with R, the actual call in the >>> program is: readLines(file('stdin'), 1). >>> >>> However, when the R program is called from Stata, R does not recognize >>> the Stata command line as a source of input and skips the steps of >>> asking for user input. Is there any way to pipe the output of the >>> Stata command line to R, or to the system command line? I hope this >>> question makes some sense... >>> >>> Thanks, >>> >>> Anthony >>> * >>> * 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/ >> * >> * 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/ > * > * 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/ * * 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/

**References**:**st: User input from shell script***From:*"Thomas, Anthony" <[email protected]>

**Re: st: User input from shell script***From:*Roberto Ferrer <[email protected]>

**Re: st: User input from shell script***From:*"Thomas, Anthony" <[email protected]>

- Prev by Date:
**st: Variance components model: why is the level two variance so high** - Next by Date:
**RE: st: Multinomial Logistic - ordinal variables and Odds Ratios** - Previous by thread:
**Re: st: User input from shell script** - Next by thread:
**Re: st: User input from shell script** - Index(es):