menu_pretty: Pretty Menu with Default Option

View source: R/menu_pretty.R

menu_prettyR Documentation

Description

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.

Usage

menu_pretty(choices, title = NULL, default = 1)

Arguments

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.

Value

The integer index of the selected option.

Examples

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")


natehall329/nate_utils documentation built on Dec. 31, 2024, 3:25 p.m.