horizontal: logical: if TRUE, display the choices horizontally, else vertically.
radio: logical: if TRUE, display the choices as radio buttons, else as buttons.
qcolor: colour for question.
gui: logical: if TRUE, getChoice is functional when called from a GUI, else it is functional from command line programs.
quiet: logical: if TRUE, don't print the choice on the command line.
Details
The user's choice is stored in .PBSmod$options$getChoice
(or whatever winname is supplied).
getChoice generates an onClose function that returns focus to the calling window (if applicable) and prints out the choice.
Returns
If called from a GUI (gui=TRUE), no value is returned directly. Rather, the choice is written to the PBS options workspace, accessible through getPBSoptions("getChoice") (or whatever winname was supplied).
If called from a command line program (gui=FASLE), the choice is returned directly as a string scalar (e.g., answer <- getChoice(gui=F) ).
Author(s)
Rowan Haigh, Pacific Biological Station, Fisheries and Oceans Canada, Nanaimo BC
Note
Microsoft Windows users may experience difficulties switching focus between the R console and GUI windows. The latter frequently disappear from the screen and need to be reselected (either clicking on the task bar or pressing . This issue can be resolved by switching from MDI to SDI mode. From the R console menu bar, select and , then change the value of single or multiple windows to SDI.
See Also
chooseWinVal, getWinVal, setWinVal
Examples
## Not run:#-- Example 1local(envir=.PBSmodEnv,expr={ getChoice(c("Fame","Fortune","Health","Beauty","Lunch"),"What do you want?",qcolor="red",gui=FALSE)})#-- Example 2local(envir=.PBSmodEnv,expr={ getChoice(c("Homer Simpson","Wilberforce Humphries","Miss Marple","Gary Numan"),"Who`s your idol?",horiz=FALSE,radio=TRUE,gui=FALSE)})## End(Not run)