Amusing way to get user input windows in R

Dec 1, 2015 00:00 · 153 words · 1 minute read R GUI

In an unlikely scenario that beautiful Shiny apps do not meet your analytical requirements and developing a full-blown user interface. in RGtk2 may seem to be a little too much, there is a third, often overlooked solution, - package svDialogs by Philippe Grosjean. The package in a convenient way enables user to create various interface gadgets. For example the code:


# Let's keep some data in one place
user_figure <- svDialogs::dlg_input()

would result in the following window being presented to the user:

Sample user input

In this case the code will return the following object:

# Classes 'nativeGUI', 'textCLI', 'gui', 'environment' <environment: 0x11872b648> 
# The default SciViews GUI (.GUI)
# using widgets from: nativeGUI, textCLI
# * Last call: dlg_input(gui = .GUI)
# * Last widgets used: nativeGUI
# * Last status: ok
# * Last result:
# [1] "100"

The post was inspired by an amusing discussion on SO.