Menu Interaction Function

DESCRIPTION:

Provides a means of developing a menu capability.

USAGE:

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

REQUIRED ARGUMENTS:

choices
character vector giving the menu choices to be presented to the user.

OPTIONAL ARGUMENTS:

graphics
logical flag: if TRUE, a graphics menu (for example, a pop-up menu) will be used if the current graphics device supports one.
title
character string to be used as the title of the menu.

VALUE:

the number corresponding to the selected item. If no selection is made, 0 is returned.

NOTE:

For non-graphics menus, the user must respond with either 0 or a number between 1 and length(choices) or a character string matching one of the menu items.

DETAILS:

This is a generic function; currently there are no methods written for it. This function can only be used in interactive mode, see interactive for details on the exact conditions.

SEE ALSO:

. To let a user of a function input a value, use .

EXAMPLES:

items <- c("List Objects", "quit") 
switch(menu(items)+1, cat("No Action\n"), ls(), q())