Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate a Pop-up box in R

Tags:

r

window

readline

Is it possible to make a pop-up box appear to the user to input a value in R? I've put together a pair of lines that perform the equivalent function using readline, but is it possible to make the prompt appear somewhere other than the console? Thank you!

like image 293
J. Kovacs Avatar asked Mar 08 '16 16:03

J. Kovacs


1 Answers

The svDialogs package provides one solution.

Running the following, for example...

 library(svDialogs)
 ## Ask something...
 user <- dlgInput("Who are you?", Sys.info()["user"])$res

... gets me the following pop-up input box:

enter image description here

(Whatever value is in the box when you click 'OK' is, as you'd expect, assigned to the symbol user.)

like image 170
Josh O'Brien Avatar answered Sep 22 '22 19:09

Josh O'Brien