GetUserChoice: Prompts the user to choose one of the given set of choices

Description Usage Arguments Value

Description

Prompts the user to choose one of the given set of choices

Usage

1
2
GetUserChoice(choices, choosing.what = "one of the following", default = 1,
  allow.range = FALSE, optional = FALSE, numbers = NULL)

Arguments

choices

vector of strings

choosing.what

string; used for presenting the instructions to the user

default

int if the user just hits enter, this will be chosen

allow.range

boolean if TRUE, the user can enter something like 2-4 which will return c(2,3,4)

optional

boolean if TRUE, user can select 0 to return false (i.e. no choice)

numbering

a vector of ints to use as the choice labels, instead of just numbering them starting at 1. optional

Value

int the index of the choice selected by the user


peichins/userinput documentation built on May 25, 2019, 12:44 a.m.