5

I would like to read an input given by User in R programming through message window.

For example, It should give a message "enter the number" in a pop up box along with option of entering a number in the message box itself. Then I would like to store that number in a variable.

Thanks for your help in advance..!

  • There are lots of suggestions [here](https://stackoverflow.com/questions/11007178/creating-a-prompt-answer-system-to-input-data-into-r) – Michael Bird Sep 08 '17 at 12:37

1 Answers1

22

The svDialogs provides such solution.

library(svDialogs)
user.input <- dlgInput("Enter a number", Sys.info()["user"])$res

which gives a pop-up as

snap1

Also, user input is stores

> user.input
[1] "68"
parth
  • 1,433
  • 10
  • 24