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.
menu(choices, graphics = FALSE, title = NULL)
NULL
is also accepted.graphics = TRUE
and a windowing system is available
(Windows, OS X or X11 via Tcl/Tk) a listbox widget is
used, otherwise a text menu. It is an error to use menu
in a
non-interactive session.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 ""
.
select.list
, which is used to implement the graphical
menu, and allows multiple selections.
## Not run:
# switch(menu(c("List letters", "List LETTERS")) + 1,
# cat("Nothing done\n"), letters, LETTERS)
# ## End(Not run)
Run the code above in your browser using DataLab