[R] How to wait for a user response in Rscript?

Duncan Murdoch murdoch at stats.uwo.ca
Sun Sep 6 18:59:38 CEST 2009


On 06/09/2009 12:52 PM, Peng Yu wrote:
> Hi,
> 
> In 'example(barplot)' running in R, I see 'Hit <Return> to see next
> plot:', then R waits for my input. I am wondering how to wait for a
> user response in Rscript.

Rscript doesn't run R interactively, so I doubt if there's a way to do 
this.  Rterm has the --ess option that asserts interactive use when 
reading piped input, so you might be able to do something like

Rterm --ess <script.R

but that's not the intended use, so you may find other problems.

If you want interactive use but don't want the full Rterm or Rgui, you 
really should be writing your own front-end.  It's not trivial, but it's 
not impossible either, and there are samples included with the R sources.

Duncan Murdoch




More information about the R-help mailing list