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: User input from shell script
From
"Thomas, Anthony" <[email protected]>
To
[email protected]
Subject
Re: st: User input from shell script
Date
Fri, 15 Nov 2013 09:28:28 -0500
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
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/