Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Stata code to run R code from within Stata and return certain pieces of the results as Stata macros


From   "Salah Mahmud" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Stata code to run R code from within Stata and return certain pieces of the results as Stata macros
Date   Sat, 31 May 2008 10:45:13 -0500

Dear Daniel,

Thanks for the helpful suggestions and pointers. I think checking to
see if the output file exists is a great idea. But Stata must delete
any existing output file before running R or alternatively use
different file names each time.

/salah

On Sat, May 31, 2008 at 2:30 AM, Daniel Becker
<[email protected]> wrote:
> Am 31.05.2008 um 09:16 schrieb Daniel Becker:
>
>>> I'm sure the devil is in the details (eg there are issues with
>>> coordinating the running of Stata and R). For instance, Stata may have
>>> to go to sleep until R signals that the code execution is over etc.
>>> But the above does not seem any more daunting than the average ado out
>>> there.
>>
>> Wouldn't the easy check be: Stata, please white until the file
>> /file/that/is/the/result/of/executing/R/ exists?
>> A variant of the pause command? How about an option
>> waitfor(/file/that/is/the/result/of/executing/R/results.txt) for rsource?
>
> problem solved: google returned
> http://datasets.org/statalist/archive/2002-06/msg00295.html
>
> capture confirm file c:\wherever\output.txt
>        while _rc { /* file does not exist! */
>        sleep 1000 /* wait 1000 ms = 1 second before trying again */
>        capture confirm file c:\wherever\output.txt
>        }
>
> Daniel
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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