This works well as now I can leave it running in the background without having it flash up or resetting window sizes. Thank you.

From: ml-node+3797286-841295777-211414@n4.nabble.com [mailto:ml-node+3797286-841295777-211414@n4.nabble.com]
Sent: Wednesday, September 07, 2011 04:12 PM
To: Thompson, Adele - Adele_Thompson@cargill.com
Subject: Re: Refresh every minute


On Sep 7, 2011, at 22:30 , Schatzi wrote:

> That works perfect. Thank you.
>


Also, for an async solution, try something along these lines

library(tcltk)
f <- function() barplot(rpois(4, lambda=3))
g <- function() {f(); if (run) tcl("after", 4000, g)} # reschedule after 4000 ms
run <- TRUE; g()

To stop it:

run <- FALSE

(With this structure, the time to run f() is added into the interval between invocations. For tighter timing control, reschedule before running f(), but then you'd better be sure it completes in time for the next iteration.)

> On Sep 7, 2011, at 3:27 PM, Schatzi wrote:
>
>> I would like some code to rerun every minute, automatically (it calls
>> time and I want this to update).
>> Here is the code (it is really the plot that I am interested in):
>>
>>
>> hourc<-as.numeric(substr(date(),12,13))
>> minc<-as.numeric(substr(date(),15,16))
>> ftime<-c(hourc,minc)
>> barplot(ftime, axes = FALSE, main="Time")
>>
>>
>> Is there any way to get this to automatically update every minute or
>> do I have to rerun it manually each time I want to see the updated plot?
>>
>
> while (TRUE) {
> hourc<-as.numeric(substr(date(),12,13))
> minc<-as.numeric(substr(date(),15,16))
> ftime<-c(hourc,minc)
> barplot(ftime, axes = FALSE, main="Time")
> Sys.sleep(60)
> }
>
>
>> I am using microsoft (vista).
>
>
> -----
> In theory, practice and theory are the same. In practice, they are not - Albert Einstein
> --
> View this message in context: http://r.789695.n4.nabble.com/Refresh-every-minute-tp3797011p3797174.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email]</user/SendEmail.jtp?type=node&node=3797286&i=0> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [hidden email]</user/SendEmail.jtp?type=node&node=3797286&i=1>  Priv: [hidden email]</user/SendEmail.jtp?type=node&node=3797286&i=2>
"Døden skal tape!" --- Nordahl Grieg

______________________________________________
[hidden email]</user/SendEmail.jtp?type=node&node=3797286&i=3> mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

________________________________
If you reply to this email, your message will be added to the discussion below:
http://r.789695.n4.nabble.com/Refresh-every-minute-tp3797011p3797286.html
To unsubscribe from Refresh every minute, click here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3797011&code=YWRlbGVfdGhvbXBzb25AY2FyZ2lsbC5jb218Mzc5NzAxMXwtNzM4MTYzNjUz>.


-----
In theory, practice and theory are the same. In practice, they are not - Albert Einstein
--
View this message in context: http://r.789695.n4.nabble.com/Refresh-every-minute-tp3797011p3797372.html
Sent from the R devel mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

