Re: [R] Printing output in STDOUT

2008-05-20 Thread Esmail Bonakdarian

Edward Wijaya wrote:

Hi,

Currently the R script I have is executed with this command:

$ R CMD BATCH mycode.R

And the output is stored in mycode.Rout.

Is there a way I can issue command from shell (like above)
so that the output is printed to STDOUT?

It's  troublesome to open the Rout file every time to debug.


Under a Unix system you could try to pipe the command into tail -f

i.e.,

$ R CMD BATCH mycode.R | tail -f

That should display the file as it gets written.

I don't have access to a Unix system right now to give this a try
but it should be a work around until someone who knows more about
R can come up with an answer.

HTH

Esmail

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Printing output in STDOUT

2008-05-20 Thread Prof Brian Ripley

On Tue, 20 May 2008, Esmail Bonakdarian wrote:


Edward Wijaya wrote:

Hi,

Currently the R script I have is executed with this command:

$ R CMD BATCH mycode.R

And the output is stored in mycode.Rout.

Is there a way I can issue command from shell (like above)
so that the output is printed to STDOUT?

It's  troublesome to open the Rout file every time to debug.


Under a Unix system you could try to pipe the command into tail -f

i.e.,

$ R CMD BATCH mycode.R | tail -f

That should display the file as it gets written.


Buffering may get in the way -- so 'gets written' may be much later than 
when it is output by R.



I don't have access to a Unix system right now to give this a try
but it should be a work around until someone who knows more about
R can come up with an answer.


What is wrong with

R --vanilla  mycode.R

or variants like

R --no-save  mycode.R
R --no-save -f mycode.R

or even

Rscript mycode.R

?  R CMD BATCH is intended (unsurprisingly) for batch use of R.


HTH

Esmail


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Printing output in STDOUT

2008-05-20 Thread Esmail Bonakdarian

Prof Brian Ripley wrote:

On Tue, 20 May 2008, Esmail Bonakdarian wrote:


Edward Wijaya wrote:

Hi,

Currently the R script I have is executed with this command:

$ R CMD BATCH mycode.R

And the output is stored in mycode.Rout.

Is there a way I can issue command from shell (like above)
so that the output is printed to STDOUT?

It's  troublesome to open the Rout file every time to debug.


Under a Unix system you could try to pipe the command into tail -f

i.e.,

$ R CMD BATCH mycode.R | tail -f

That should display the file as it gets written.


Buffering may get in the way -- so 'gets written' may be much later than 
when it is output by R.


Yes, that's quite likely to be the case .. I like your suggestions
below much better - saved away for future reference too.

Esmail

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.