On Sat, 2004-11-27 at 11:42 -0500, Terry Mu wrote:> I used pause() from library(DAAG) to pasue between plots. This works
> when I source a script, but seems don't work when I run (ctrl + R) the
> script in R.
>
> Did I do something wrong? Thanks.
The standard way to pause between plots is to set 'par(ask = TRUE)'
before your first plot, which will then prompt you to continue after
each new plot. See ?par for more information.
I am presuming that you are using Windows, which you do not indicate,
with CTRL-R being the command to paste and run code from the R Windows
GUI editor.
>From a scan of the code for DAAG's pause(), it appears to use the
readline() function to prompt for user input as the basis for the
pausing.
A scan of the source code in .../gnuwin32/editor.c indicates that the
copy and paste operation to the Rgui console from the editor takes place
via the clipboard in function editorrunselection, if my read is correct.
I would defer to Duncan Murdoch and Prof. Ripley here, but I suspect
that there may be some interaction between readline() and the
copy/paste/run mechanism that precludes pause() from running in this
situation.
A quick test you might want to run would be to replace pause() with:
readline(prompt = "Pause. Press <Enter> to continue...")
in your code to see if this behavior continues, independent of the DAAG
package. You should also notify the DAAG package authors/maintainer of
the issue.
HTH,
Marc Schwartz