Asks the user for one yes/no question. If the users replies with a "yes" (or Y, or y) the function returns TRUE. Otherwise, FALSE. (also exists as the function devtools::yesno)
ask.user.yn.question(question, GUI = TRUE, add_lines_before = TRUE)
question | a character string with a question to the user. |
---|---|
GUI | a logical indicating whether a graphics menu should be used if available. If TRUE, and on Windows, it will use winDialog, otherwise it will use menu. |
add_lines_before | if to add a line before asking the question. Default is TRUE. |
TRUE/FALSE - if the user answers yes or no.
https://stackoverflow.com/questions/15250487/how-to-add-a-menu-item-to-rgui (my thanks goes to Dason for his answer and help)
menu in the utils package, yesno in the devtools package.
if (FALSE) { ask.user.yn.question("Do you love R?") ask.user.yn.question(question = "Do you love R?", GUI = TRUE) # the same one as before ask.user.yn.question(question = "Do you love R?", GUI = FALSE) # reverts to command line questions ask.user.yn.question("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Do \n you \n love R?") # checking how it deals with multi lines, and a lot of text (very good actually) }