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, quitbutton = FALSE, 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). |
quitbutton |
this defaults to FALSE. Set to TRUE this creates a button which will close the window and escape from a rp.block call. Before the window is destroyed the action function will be called. |
pos |
the layout instructions. Please see the |
... |
information for |
The function action
should take one argument, which should be the panel.
See rp.grid
for details of the grid layout system.
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 panel's environment 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 package. Journal of Statistical Software, 17, issue 9.
if (interactive()) { # 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") }