As a test I used the Hello Shiny example on the Shiny tutorial webpage:
https://shiny.rstudio.com/tutorial/written-tutorial/lesson1/
The Shiny package was installed into the R environment per the instructions on the webpage.
As with any use of the R node, the Rserve server must be started in the R console before using the R node.
The R node was configured as follows:
The components of the Hello Shiny application in the tutorial were copied into a text editor. The Shiny application script was then saved in the specified directory as the file "app.R".
When the R node was run, the Shiny application was opened in a new browser tab.
However, when the browser tab was closed, the R node continued to run. Using the 'Stop' button on the Analyze menu causes the node to generate an error. Also, when the R node was re-run the Shiny application was not displayed. To get the application to launch again it was necessary to end the rserve.exe task in the Taskmanager and then re-start it in the R console.
To overcome this issue the Hello Shiny example was modified to stop the application when the browser is closed. This allows the execution of the script in the R environment to complete, which in turn enables the R node to also complete successfully. The server component of the script was changed to include the session attribute and a function was defined to stop the application when the sessionEnded event is detected.
When the modified script is used and the Shiny application's browser tab is closed, the R node completes successfully.
An example data flow is attached (requires Analyze 3.6.0 or above). Note that it is necessary to ensure the R node library node is located within your My Documents directory. You may need to ensure the library search paths are set to include the My Documents directory.
Note: The data flow does not contain the R node library node dependency (ensure you have installed it on your system before attempting to import the data flow).
The modified Hello Shiny application script is also attached. The appDirPath specified in the R node script should be changed to correspond with the directory where the Shiny application script has been saved.
The R node's RScript property contents are also attached for completeness. Note, the script assumes the R Node has been augmented to have an input pin ('in1') and an output pin ('out1').
Limitations: The ability to launch a Shiny application from within Analyze is likely to be limited to the Desktop edition. The functionality is unlikely to operate on an Analyze Server instance (Linux or Windows Server).
Attached files
R_Node_Launch_Hello_Shiny_Example--share - 14 Jan 2021.lna
app.R
R_Node_Launch_Shiny_App_RScript_Contents.txt