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.
On Feb 9, 2009, at 6:21 PM, Rolf Turner wrote:
>
> On 10/02/2009, at 12:09 PM, Fuchs Ira wrote:
>
> > Yes, Windows has that in the Misc menu, but I don't see a way to do
> > this on the Mac.
>
> In my experience output is not buffered on a Mac.
> Are you actually *printing* out the results you want to see?
>
> Could you, as the posting guide requests, provide a minimal
> self-contained example?
>
> cheers,
>
> Rolf Turner
> >
> > On Feb 9, 2009, at 5:51 PM, Duncan Murdoch wrote:
> >
> >> On 09/02/2009 5:07 PM, Fuchs Ira wrote:
> >>> I would like to have a function which gets data, does a
> >>> calculation and prints a result and then waits some number of
> >>> seconds and repeats. If I use Sys.sleep, the execution is
> pausing
> >>> but the function output is buffered so that it all comes out when
> >>> the function terminates. How can I get output while the function
> >>> continues to execute?
> >>
> >> Turn off buffering. In Windows, this is a menu item. Presumably
> >> it's possible on whatever platform you're using.
> >>
> >> Duncan Murdoch
>
> ######################################################################
> Attention:
> This e-mail message is privileged and confidential. If you are not the
> intended recipient please delete the message and notify the sender.
> Any views or opinions presented are solely those of the author.
>
> This e-mail has been scanned and cleared by MailMarshal
> www.marshalsoftware.com
> ######################################################################
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.