rp.checkbox {rpanel}R Documentation

Check Box widget for rpanel

Description

Adds a checkbox to the panel, to control a logical variable.

Usage

rp.checkbox(panel, var, action = I, parent = window, title = deparse(substitute(var)), initval = NULL, pos = NULL)

Arguments

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.

Details

The function action should take one argument, which should be the panel to which the checkbox is attached.

Value

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.

Warning

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.

References

rpanel: Simple interactive controls for R functions using the tcltk package (http://www.stats.gla.ac.uk/~adrian/research-reports/rpanel.ps)

See Also

rp.radiogroup,rp.control

Examples

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)

[Package rpanel version 1.0-3 Index]