rp.checkbox {rpanel} | R Documentation |
Adds a checkbox to the panel, to control a logical variable.
rp.checkbox(panel, var, action = I, parent = window, title = deparse(substitute(var)), initval = NULL, pos = NULL)
panel |
the panel in which the checkbox should appear. This may be passed as a panelname string or the panel object itself. |
var |
the name of the variable within the panel that the checkbox should control. |
action |
the function to call whenever the checkbox is clicked. |
title |
the title of the checkbox. This defaults to the name of the variable var. |
parent |
this specifies the widget inside which the checkbox should appear. In the current version, it should not normally be used. |
initval |
the initial value for the variable var (optional). The initial value can also be specified in the call to rp.control . |
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 to which the checkbox is attached.
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)
oncheck <- function(panel) { if (panel$cb) cat("Box is checked\n") else cat("Not checked!\n") panel } panel <- rp.control() rp.checkbox(panel, cb, action = oncheck)