[R] Pause in non-interactive mode

Jonne Zutt jonne.zutt.ml at gmail.com
Fri Feb 5 10:31:15 CET 2010


Dear all,

I've found this nice code fragment on the web
(from Jan T. Kim if I'm correct):

hitReturn <- function(msg)
{
	invisible(readline(sprintf("%s -- hit return", msg)));
}

But it does not seem to work in non-interactive mode
( I mean, when I start a script like this: R --vanilla < script.R )

It simply continues, I guess the stdin is not connected?

Does somebody know how to make it work.

My script plots a few graphs (in X11 windows) and I don't want them to
disappear immediately.
A Sys.sleep(infinite) would probably work, but I thought there might
be a better solution?

Thanks,
Jonne.



More information about the R-help mailing list