rp.timer {rpanel}R Documentation

Creates a series of timed actions

Description

This creates an interval timer and allows the user to set the criteria to stop the timer.

Usage

rp.timer(panel, microseconds, action, where)

Arguments

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.

Details

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.

References

rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.

See Also

rp.control

Examples

## 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)

[Package rpanel version 1.1-5.2 Index]