Bookmark and Share

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   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: User input from shell script
Date   Thu, 14 Nov 2013 19:05:58 -0500

Anthony, you can let the user input from Stata's command line with:

display "Enter parameter alpha: " _request(alpha)
display $alpha

Later you can pass this parameter to R if needed.

Best, Sergiy Radyakin

On Thu, Nov 14, 2013 at 5:15 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index