Skip to content
Advertisement

RStudio Server on linux: how to create a shiny app that immediately returns user input text if button OK pressed, or FALSE if button CANCEL pressed

I want my function to implement a dialog with an editable text box using a shiny app.

I.e. calling the function should open a shiny app displaying some text for the user to edit, then press the ‘Ok’ button to close the app and return the edited text or the ‘Cancel’ button to close the app and return an empty character vector.

My code runs fine on Windows (Rstudio desktop). However on Linux (Rstudio Server Pro) the shiny page is displayed but the interface seems to be greyed, the text can be edited but the buttons are not responsive. Why?

EDIT

The unresponsiveness problem occurs with Internet Explorer and Microsoft Edge, not Chrome. Although the page in Chrome is greyed too, and opening Chrome’s ‘Inspect’ tool shows 2 errors:

JavaScript

[where XXXXXXXXXXXXXXX stands for my Rstudio Server’s URL]

JavaScript

sessionInfo:

JavaScript

Advertisement

Answer

It turns out this problem was due to a server (mis)configuration. Interestingly, I found out that setting option shiny.host to the IP address of the server (instead of the default 127.0.0.1) enabled interaction with the shiny app, e.g.:

JavaScript

The following code could be used to set this option dynamically on a Linux host, useful in case load balancing gets the user connected to one of several Rstudio servers:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement