I have a complete program in R, where I first ask the user for a number, using the menu function:
menu(c('1','2','3'),title='Escolha um numero')
Next, a few lines of code below, this chosen number is required for some functions. It is required that the program be as independent as possible, ie, user "Run all", enter the number and then the program will run alone and give the final result. The problem is that when executing "Run all", the program does not wait for the user to enter the number and execute an infinite cycle or the program gives error. Is there a function that can cause R to wait for the user to enter the number and only then continue the program using "Run all"?