interactive_fun: Turn a function into interactive function

Description Usage Arguments Value See Also Examples

View source: R/utils-cliui.R

Description

A function normally needs be provided value for arguments to be called. We could turn a normal function into a function with ability to be called interactively, i.e. we could call it interactively by asking user to provide value for each argument during execution.

Usage

1
interactive_fun(fun, quiet = FALSE, debug = FALSE)

Arguments

fun

a function to be executed.

quiet

a logical of whether display interactive message. Default FALSE means display interactive message in execution.

debug

a logical of whether execute fun in simulation mode or real mode. Default FALSE means to execute function in real mode.

Value

a function which could be called in interactive mode.

See Also

Other utils_cliui: help_fun(), interactive_call()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 


# Turn print() into interactive function and call it interactively
inter_print <- interactive_fun(print)
inter_print()


# Turn print() into interactive function and call it interactively,
# execute it without displaying information
inter_print <- interactive_fun(print, quiet = TRUE)
inter_print()

# Turn print() into interactive function and call it interactively,
# execute it in debug mode
inter_print <- interactive_fun(print, debug = TRUE)
inter_print()

## End(Not run)

chriszheng2016/zstmodelr documentation built on June 13, 2021, 8:59 p.m.