select_menu | R Documentation |
Presents a list of choices to the user, allowing them to select one or more options by entering numbers.
If the user inputs an empty line, the function skips the selection and returns NULL
.
select_menu(
choices,
title = NULL,
msg = "Enter one or more numbers, or an empty line to open files: ",
width = getOption("width")
)
choices |
character: vector of options to display to the user. Each choice will be prefixed with a numbered label. |
title |
character: optional string to display as the title of the menu. Default is |
msg |
character: string specifying the prompt message for user input. Default is |
width |
integer: specifying the maximum line width for displaying the menu. Defaults to the value of the |
This documentation was created with the support of ChatGPT.
A character vector of selected choices, or NULL
if the user enters an empty line.
Based on select_menu()
in the package remotes
## Not run:
# Example usage:
options <- c("Apple", "Banana", "Cherry", "Date")
selected <- select_menu(options, title = "Choose your fruits:")
cat("You selected:", paste(selected, collapse = ", "), "\n")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.