menu_pretty | R Documentation |
Displays a menu with a list of choices and allows the user to make a selection. If the user hits return without making a selection, a default option is chosen.
menu_pretty(choices, title = NULL, default = 1)
choices |
A character vector containing the menu options. |
title |
An optional character string specifying the title of the menu. Default is NULL. |
default |
An integer specifying the default option to select if the user hits return without making a selection. Default is 1. |
The integer index of the selected option.
choices <- c("Option 1", "Option 2", "Option 3")
selected <- menu_pretty(choices, title = "Please select an option:", default = 2)
cat("You selected option", selected, "\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.