rpanel (version 1.1-4)

rp.control: Create or dispose of an rpanel

Description

The function rp.control creates a panel window into which rpanel widgets can be placed. It can also set up variables within the rpanel object. The function rp.control.dispose disposes of an rpanel.

Usage

rp.control(title = "", size = c(100, 100), panelname, background, ...)
rp.control.dispose(panel)

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. It is usually not necessary to set this as it will be given a name automatically.

background

the background colour of the control e.g. "white". (New parameter with version 2.0.)

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. Note that the names of these additional arguments should not conflict with those of the main arguments of rp.control.

panel

the panel to be disposed of. This represents the object and its parameters

Value

The list object which defines the panel.

Details

Objects passed into rp.control are then available to be used by action functions.

References

rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.

See Also

rp.button, rp.checkbox, rp.combo, rp.doublebutton, rp.grid, rp.image, rp.listbox, rp.menu, rp.radiogroup, rp.slider, rp.text, rp.textentry, rp.tkrplot, rp.widget.dispose

Examples

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

   # Try also
   # panel <- rp.control()
   # rp.control.dispose(panel)
# }

Run the code above in your browser using DataCamp Workspace