menu                  package:utils                  R Documentation

_M_e_n_u _I_n_t_e_r_a_c_t_i_o_n _F_u_n_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     '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'.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

 choices: a character vector of choices

graphics: a logical indicating whether a graphics menu should be used
          if available.

   title: a character string to be used as the title of the menu.
          'NULL' is also accepted.

_D_e_t_a_i_l_s:

     If 'graphics = TRUE' and a windowing system is available (Windows,
     MacOS X or X11 _via_ Tcl/Tk) a listbox widget is used, otherwise a
     text menu.

     Ten or fewer items will be displayed in a single column, more in
     multiple columns if possible within the current display width.

     No title is displayed if 'title' is 'NULL' or '""'.

_V_a_l_u_e:

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

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

     'select.list', which is used to implement the graphical menu, and
     allows multiple selections.

_E_x_a_m_p_l_e_s:

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

