[R] pause in function execution

Rolf Turner r.turner at auckland.ac.nz
Tue Feb 10 01:12:32 CET 2009


On 10/02/2009, at 12:55 PM, Duncan Murdoch wrote:

> On 09/02/2009 6:27 PM, Fuchs Ira wrote:
>> a=function() {
>> print("start")
>> print(Sys.time())
>> Sys.sleep(5)
>> print(Sys.time())
>> print("end") }
>>
>> a()
>>
>> results in:
>>
>> [1] "start"
>> [1] "2009-02-09 18:25:41 EST"
>> [1] "2009-02-09 18:25:46 EST"
>> [1] "end"
>>
>> all printed together after 5 seconds.
>
> The reason for this mysterious difference is presumably that you  
> are not
> using the same front-end as Rolf, or maybe not the same version as  
> him,
> or maybe you have the buffering set differently.
>
> sessionInfo() would remove some of the mystery, but I don't think it
> says which Mac front end you're using.  We should fix that. (It's not
> just a Mac deficiency, Windows has the same omission.)

Looking at the code of flush.console() (suggested by Remko Duursma)
solved the mystery.  It refers to the AQUA GUI.  I don't use the
GUI as a rule; I start R from the command line.

When I started R from the GUI I got the same buffered phenomenon
that afflicted Ira Fuchs.  So one solution to his problem would
presumably be to start R from the command line rather than by
clicking on the GUI.

There must be a way to switch off buffering when using the AQUA GUI
though.  Mustn't there?

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list