rp.checkbox(rpanel)
rp.checkbox()所属R语言包:rpanel
Check Box widget for rpanel
检查为rpanel Box小部件
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Adds one or more checkboxes to the panel, to control logical variables.
将一个或多个复选框添加到面板上,控制逻辑变量。
用法----------Usage----------
rp.checkbox(panel, var, action = I, labels = NA, names = labels, title = NA,
initval = NA, parent = window, pos = NULL, doaction = FALSE, ...)
参数----------Arguments----------
参数:panel
the panel in which the checkbox(es) should appear. This may be passed as a panelname string or the panel object itself.
面板应该会出现在其中的复选框(ES)。这可能是通过作为一个panelname的字符串或面板对象本身。
参数:var
the name of the variable within the panel that the checkbox(es) should control.
该复选框(ES)应控制面板内的变量的名称。
参数:action
the function to call whenever a checkbox is clicked.
要调用的函数,只要单击一个复选框。
参数:labels
the labels of the checkboxes. This defaults to the name of the variable var plus an identifying integer.
标签的复选框。这是预设的名称的变量var加上一个确定的整数。
参数:names
the names attached to the elements of var. These provide a helpful means of referring to particular items in multiple checkboxes.
名称附着元素var。这提供了一个有用的手段,特别是在多个复选框的项目。
参数:title
the title of the checkbox group. This defaults to the name of the variable var. If there is only one box, and labels is not specified, title is taken as the label.
标题的复选框组。这是预设的变量var的名称。如果只有一个方格,labels没有被指定,title被作为标签。
参数:initval
the initial value for var (optional). The initial value can also be specified in the call to rp.control.
var(可选)的初始值。的初始值,也可以指定在调用rp.control。
参数:parent
this specifies the widget inside which the checkbox should appear. In the current version, it should not normally be used.
这指定的窗口小部件的复选框内出现。在目前的版本中,它不应该被使用。
参数:pos
the layout instructions. Please see the rp.pos example and help for full details.
布局说明。请看看rp.pos榜样和帮助的完整细节。
参数:doaction
a logical variable which determines whether the action function is called when the widget is created. The default is FALSE, so that the rp.do function should be called after all widgets have been created, to initialise the state of the panel display.
一个逻辑变量,它决定是否小部件的动作函数被调用时被创建。默认值是FALSE,使rp.do函数被调用后的所有部件已创建,初始化面板显示的状态。
参数:...
information for pos can be passed individually as additional arguments.
pos的信息可以通过单独作为附加参数。
Details
详细信息----------Details----------
The function action should take one argument, which should be the panel to which the checkbox is attached. See rp.grid for details of the grid layout system.
函数action应该接受一个参数,这应该是面板的复选框。见rp.grid的网格布局系统的详细信息。
值----------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 panel's environment level.
如果该参数面板是panelname的的字符串相同的字符串返回。如果面板对象是用来改变的面板被分配到的层次和面板的环境。
警告----------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.
action函数应该返回面板。如果没有这个任务,任何部件或内action功能面板参数的改变将会丢失。
参考文献----------References----------
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
参见----------See Also----------
rp.radiogroup,rp.control
rp.radiogroup,rp.control
实例----------Examples----------
if (interactive()) {
plot.hist <- function(panel) {
with(panel, {
xlim <- range(c(x, mean(x) + c(-3, 3) * sd(x)))
if (panel$cbox[3])
clr <- "lightblue" else clr <- NULL
hist(x, freq = FALSE, col = clr, xlim = xlim)
if (panel$cbox[1]) {
xgrid <- seq(xlim[1], xlim[2], length = 50)
dgrid <- dnorm(xgrid, mean(x), sd(x))
lines(xgrid, dgrid, col = "red", lwd = 3)
}
if (panel$cbox[2])
box()
})
panel
}
x <- rnorm(50)
panel <- rp.control(x = x)
rp.checkbox(panel, cbox, plot.hist,
labels = c("normal density", "box", "shading"), title = "Options")
rp.do(panel, plot.hist)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|