rp.textentry {rpanel} | R Documentation |
This function adds a box allows text to be entered.
rp.textentry(panel, var, action = I, title = deparse(substitute(var)), initval = NULL, parent = window, pos = NULL)
panel |
the panel in which the text entry box should appear. This may be passed as a panelname string or the panel object itself. |
var |
the name of the variable which will be assigned the text entered into the box. |
action |
the function which is called when the text has been entered. |
title |
the label for the text entry box. |
parent |
this specifies the widget inside which the text entry widget should appear. In the current version, it should not normally be used. |
initval |
the initial value for 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 textentry 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 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 library (http://www.stats.gla.ac.uk/~adrian/rpanel/)
density.draw <- function(panel) { h <- as.numeric(panel$h.text) plot(density(panel$x, bw = h)) panel } panel <- rp.control(panelname = "thepanel", x = rnorm(50)) rp.textentry(panel, h.text, density.draw, "bandwidth", initval = "0.5") rp.do(panel, density.draw)