Skip to contents

This function aims to loosely mimic the behavior of the questdlg function on Matlab

Usage

questdlg(
  quest,
  dlgtitle = "",
  btn = c("y", "n"),
  defbtn = "n",
  accepted_ans = c("y", "yes", "n", "no")
)

Arguments

quest

Question

dlgtitle

Title of question

btn

Vector of alternatives

defbtn

Scalar with the name of the default option

accepted_ans

Vector containing accepted answers

Value

Whatever is entered by the user after the prompt created by the function.

Examples

if (FALSE) {
  ans <- questdlg("Do you want to continue?", "Continue?")
  if (tolower(substring(ans, 1, 1)) == "y") {
    message("You typed yes")
  } else {
    message("You didn't type yes")
  }
}