rp.timer | R Documentation |
This creates an interval timer and allows the user to set the criteria to stop the timer.
rp.timer(panel, microseconds, action, where)
panel |
the panel which has some relevant variables. |
microseconds |
time between each call of action. |
action |
function to be executed on each timer tick. |
where |
a function which should return true or false, taking parameter panel. When false the loop will stop. |
This allows the user to setup an interval timer and the function to be called at each 'tick'.
Care should be taken when writing code to anticipate interactions with the panel while activity controlled by a timer is underway, as these interactions may cause changes in the state of the panel.
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
rp.control
## Not run: stopme <- function(panel) panel$count<=20 callme <- function(panel) { print(panel$count) panel$count = panel$count+1 panel } panel <- rp.control(count=1) rp.timer(panel, 500, callme, stopme) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.