dialogMaker: Automatically create a dialog for a function

Description Usage Arguments Details Value Examples

Description

Function must have a special markup for its argument. A named argument a..b is interpreted with b determining the type of item to use. We support numeric, string, choice, range, ??? Within the body of the function, the variable a..b should be referred to by a. The idea is that you write and debug the function as usual, then simply modify the argument list to include the types. This function will not work for functions whose arguments use lazy evaluation referring to other argument's values.

Usage

1
2
dialogMaker(f, title = "Dialog", help_string = "", make_gui = TRUE,
  add_graphic_device = FALSE, ...)

Arguments

f

function to make dialog for. Its arguments must be specified in a certain way.

title

Title for dialog window

help_string

String for help information

make_gui

If TRUE or add_graphic_device=TRUE then call dialogs make_gui method

add_graphic_device

If TRUE add an graphicDeviceItem to dialog

...

passed to make_gui when no graphic device asked for

Details

All arguments should have a default A choice items should have its default with a vector. The first argument is the selected one A range item is specified with values c(from=., to=..., by=..., [value=from]). If value not give, then from is used. The OK_handler will call f.

Value

Returns an instance of aDialog.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
f <- function(x..numeric=1, y..string="a") print(list(x,y))
## Not run: dialogMaker(f)
## can have missing arguments
f <- function(x, y..numeric=1) print(list(x,y))
## Not run: dialogMaker(f)
## a choice item. Sizing is funny for tables
f <- function(x..choice=letters) print(x)
## Not run: dialogMaker(f)
## range items
f <- function(x..numeric=0, mu..numeric=0,
              alternative..choice=c("two.sided","less","greater"),
              conf.level..range=c(.80,1.00, .01, .95)) {
              out <- capture.output(t.test(x, alt=alternative, conf.level=conf.level))
              print(out)
}
## Not run: dialogMaker(f, title="CI from t.test with summarized values")

traitr documentation built on May 2, 2019, 3:32 p.m.