menu {utils}R Documentation

Menu Interaction Function

Description

menu presents the user with a menu of choices labelled from 1 to the number of choices. To exit without choosing an item one can select 0.

Usage

menu(choices, graphics = FALSE, title = "")

Arguments

choices a character vector of choices
graphics a logical indicating whether a graphics menu should be used. Currently unused.
title a character string to be used as the title of the menu

Value

The number corresponding to the selected item, or 0 if no choice was made.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Examples

## Not run: 
switch(menu(c("List letters", "List LETTERS")) + 1,
       cat("Nothing done\n"), letters, LETTERS)
## End(Not run)

[Package Contents]