rp.control {rpanel}R Documentation

Create an rpanel

Description

This function creates a panel window into which rpanel widgets can be placed. It also returns, and can set up variables within, the rpanel object.

Usage

rp.control(title = "", size = NULL, panelname, realname, aschar = TRUE, ...)

Arguments

title the title of the panel displayed in the banner.
size a two-element numeric vector specifying width and height of the panel in pixels. If this argument is omitted the size of the panel will adapt to the subsequent addition of widgets.
panelname the name of the panel at .GlobalEnv. If this is not assigned, then realname is taken.
realname retained for backward compatibility. If this is not assigned, the realname is assigned automatically using rp.panelname.
aschar if TRUE (default) the panel's name as a string is returned. If FALSE the panel list itself is returned.
... additional arguments which are treated as variable initialisations and are stored within the returned rpanel object. For example inserting x=3 creates a variable x in the rpanel object with the value 3.

Value

Dependent on parameter ischar. If ischar is TRUE this is the string name of the panel if FALSE this is the list object which defines the panel.

References

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

See Also

rp.button,rp.slider,rp.doublebutton,rp.textentry,rp.checkbox,rp.radiogroup

Examples

hist.or.boxp <- function(panel) {
  if (panel$plot.type == "histogram")
    hist(panel$x)
  else
    boxplot(panel$x)
  panel
}
panel <- rp.control(x=rnorm(50))
rp.radiogroup(panel, plot.type, c("histogram", "boxplot"), title="Plot type", action = hist.or.boxp)  

# Try also
# panel <- rp.control(ischar = TRUE) # returns a string ".rpanel1" in panel
# panel <- rp.control(ischar = FALSE) # returns the panel list object itself

[Package rpanel version 1.0-3 Index]