rp.button {rpanel} | R Documentation |
This function adds a button to the panel. A nominated function is called when the button is pressed.
rp.button(panel, action, title = deparse(substitute(action)), id = "", parent = window, repeatdelay = 0, repeatinterval = 0, pos = NULL)
panel |
the panel in which the button should appear. This may be passed as a panelname string or the panel object itself. |
action |
the function executed when the button is pressed. |
title |
the text displayed on the button. |
id |
the name of the button. This is helpful in allowing possible modification and layout changes which have not been implemented and will be considered later. |
parent |
this specifies the widget inside which the button should appear. In the current version of rpanel, it should not normally be used. |
repeatinterval |
the interval between auto-repeats (milliseconds) when the button is held down. |
repeatdelay |
the time after which the button starts to auto-repeat (milliseconds). |
pos |
the layout instructions. Please see the rp.pos example and help for full details. |
The function action
should take one argument, which should be the panel.
If the parameter panel is the panelname string the same string is returned. If the panel object is used the altered panel is assigned to both the calling level and global level.
The action
function should return the panel.
Without this assignment any widgets added or alterations made to panel parameters within
the action
function will be lost.
rpanel: Simple interactive controls for R functions using the tcltk library (http://www.stats.gla.ac.uk/~adrian/research-reports/rpanel.ps)
# This function will be called on pressing the button "Simulate". boxp.sim <- function(panel) { boxplot(rnorm(50)) panel } # Create an rpanel and add the button "Simulate" to it. panel <- rp.control() rp.button(panel, action = boxp.sim, title = "Simulate")