Learn R Programming

GenoView (version 1.6.0)

printOption: Print numbered options

Description

Prints a numbered list as a guide for selecting an option or an index.

Usage

printOption(opt.vec, inst = TRUE, desc = "an option", match.opt = FALSE, match.ind = FALSE)

Arguments

opt.vec
A vector of printable objects, preferably character, which fits the descriptor desc.
inst
Controls instruction printing using desc.
desc
A char which indicates the type of object in opt.vec.
match.opt
Chooses the selected element from opt.vec.
match.ind
Chooses the index of the selected element from opt.vec.

Value

The selected object from opt.vec if match.opt = TRUE. The integer index if match.ind = TRUE.

Examples

Run this code
colours <- c("Red", "Blue", "Green", "Yellow")
printOption(colours, desc = "a colour") ## no return value

if (interactive()){
printOption(colours, desc = "a colour", match.ind = TRUE) # returns integer

printOption(colours, desc = "a colour", match.opt = TRUE) # returns character
}

Run the code above in your browser using DataLab