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)

