R shiny app: Provide API-like interface for other calling applications - r

I have a running shiny app that displays some output-metrics on screen in response to purely on-screen UI inputs (no files to be read etc.) I can host it on shinyapps.io to make it accessible remotely 24x7.
A programmer working on another application (non-R, residing on a remote server) wants to access my shiny app to get my output-metrics into his code. What's a good way to do this?
On the input side, with bookmark-able state via the calling url it looks like I can get all inputs from the calling app.
What I haven't figured out is any way to send back outputs to the calling app with the current shiny framework. What I currently show on screen I want to be able to send back to the calling app.
Any ideas?
PS. There's rumors that some native functionality to provide this use-case is coming to shiny but there's nothing yet and I'm impatient to finish this project.

Related

Is it possible to share a local R/Shiny app but prevent access to its source code?

Let's imagine you want to share a shiny app not remotely (i.e. without using shinyapps.io or a Shiny Server on the web - which may occur due to security issues), therefore you may need to "locally" share your app files (using DesktopDeployR for instance).
Is there a way to protect app source code from being read?

Possibility of getting offline shinyApp without Publish Button, csv Data and seeing R code?

Hi guys i have made a shinyApp for a client using R.
The client for whom I’m working is asking for a shinyapp that works offline preferably in the form of an application or shiny window (as the online link of shinyapp.io will put load on the server). He wants to get the shiny output without seeing the R code.
He will later handover the shinyApp to his employees (>200) and they will mostly use the offline shinyApp on their desktop (in shiny window). Furthermore the data is very confidential so the client doesn't want his employees to either get csv data or publish the app online or see R code. Because every time they would run the app, they require csv data or codes to generate output.
That's why he doesn’t want a publish button anywhere in the app so that his employees doesn’t publish the app online.
Is there any way to do so? Any suggestions would be much appreciated
Method 1
I feel this is the best way to do it. This will give you an exe setup to install on your clients' server If you find it complicated you can try the below method, but my first preference would be this one.
Method 2
The process of making your standalone app is best explained here.
You can also use this site. If you feel the first is a little ambiguous
It is very much possible, and I do it often. If you have any doubts, you can ask me. This will not show the code to your client, it will be like any other desktop/server app, although the code can be seen if the app is probed, unlike the first method.
You can put the packaged app in a server which serves the local IPs.
I think you can do it without any hassle. Just follow the instructions line by line.
Regards/Revanth Nemani

Shiny reconnecting to existing session

I created a Shiny app which is doing a long computation and therefore i am running it on a local server in my Network.
I can access the app via my computer, upload files and start the calculation. But when I close the browser and access the app via a weblink again, Shiny will start a new empty session.
How can I reconnect to the "closed" session with the hopefully still running computation and uploaded files?
It seems that it may be possible with RStudio Connect or running the app via a ShinyServer. Is there another easy way to handle it?
Reconnecting to the exact same session seems not possible. I found after a lot of research the Bookmark function, which saves your Input inside a new URL or on a Server. See references here: Link
Unfortunately, it didnt work really good because i had bigger plots and tables as saved output.
I solved the problem with a workaround. In the end of the computation i save the whole environment with save.image(file='myEnvironment.RData')
I added an actionbutton and by clicking it loads the saved environment with load('myEnvironment.RData'). After this, all files are back in the environment and new outputs can be created by e.g. output$xy <- renderPlot({XY}).
Hope that helps

Create a log in screen for shiny app without shiny server

I am fairly new to Shiny, but have created an app which I am hosting locally without shiny server.
What I'd like to do, is create a log in screen, which means that only authorised users can access my app.
Is there a way to do this? I have only found examples which use the shiny server, and this is something I do not want to do. I have also read something about Apache Web Server, but I wasn't sure how to do this, or if I needed to download something to get this set up.
Any help would be appreciated.

Open a different Shiny application by clicking link in a Shiny application

I am building my first Shiny app and have been struggling with one issue that I am not even sure if it is possible to do.
I want to allow a user to click a link (or select something or click a button; some user action), and after this I want another Shiny app to be open in front of the user (the previous one might be shut down; I no longer care about it). To put it in other words, I want to make something like the following work:
if(input$datasetlist == "cars"){
runApp("C:/.../readdata")
}
Of course, trying this naive code returns a warning:
Error in startServer("0.0.0.0", port, httpuvCallbacks) :
Failed to create server
What is the correct approach for this, if it is even possible?
There's not a way to do this now in Shiny natively, but you might be interested in Shiny Server. It allows you to host multiple applications concurrently. It will manage the startup and shutdown of apps based on whether or not they're being used.
So you could just host all your apps in Shiny Server, then provide regular links (a(href="/anotherApp")) to allow users to navigate between apps.

Resources