Shiny App doesn't work while accessing on remote computer - r

I am trying to run a ShinyApp via R studio. The R Studio is on my work computer and I am accessing it from my home computer via remote access.
I tried changing the host argument in runApp to "0.0.0.0" (as suggested:here )
and even then all i get is a dark blank screen.
Any help, appreciated.

Thanks to a few colleagues at work, I figured that there could be an issue with accessing the shiny output via R studio in built browser when accessing it remotely.
The workaround which works for me is to open a new browser via
runApp(shinyobject<-shinyApp(ui, server), launch.browser=T)

Related

Switching between tabs not possible online

I wrote a shiny app which works fine on my machine and on my server. Now I migrated the app to another virtual server (running Ubuntu 22.04 LTS). I can access the virtual server via a GUI and when I run the app on that virtual server in Rstudio it works fine. When I access the app (running with free shinyserver) from the internet, I reach the application and can see the dashboard. It actually looks fine, all the links work and so on, but I cannot switch between dashboard tabs. When I click on a tab, the webpage changes from "webpage/" to "webpage/#tab-2470-2" (or some other number behind "#tab-") but nothing happens.
Since the R code and the shiny config on my server (where everything works) and the new virtual server is exactly the same, I presume that the virtual server is missing some packages. It's a fresh installation aside from R, Rstudio, shinyserver, the required dependencies and all updates. The problem is that I do not get any error messages (shiny log directory is empty), so I do not even know where to start troubleshooting.
So I am wondering if anyone experienced the same behaviour or has an idea what I am missing?
Thanks in advance!

Problem using readClipboard() in Shiny app deployed to shinyapps.io

I have created a Shiny App that relies on reading data directly from the user's clipboard. This Shiny app works perfectly when running on my local machine; however when I deploy the app to shinyapps.io I get the following error:
Warning: Error in readClipboard: could not find function "readClipboard"
This question was raised before but didn't receive an answer: Paste from client's clipboard on Shiny Server
My hunch is that I'll probably need to incorporate some javascript function which allows the web browser to read the user's clipboard...but I have zero idea where to start on that :-(
Has anyone achieved this functionality before in a Shiny App deployed to shinyapps.io?
This is likely because shinyapps.io runs in a Linux server, and readClipboard()only works on Windows OS. So I am assuming that you are running locally on a Windows machine.
You could try the package clipr.
I never tried myself, but I read that it works on Linux.
From the site where I read about the package
Note that on Linux, you will need to install the system requirement, either xclip or xsel. This can be done using for example apt-get install xclip.
I have an app running on a Linux server, and I use the following statement to be able to test it in Windows (in my case is access to a database that is different between systems)
if (tolower(Sys.info()['sysname']) == "linux") {
# Linux code here
} else {
# Windows code here
}

Error when hosting shiny app on DigitalOcean ubuntu server

I have built a shiny app that I have successfully deployed to shinyapps.io in the past. However, since I need better hosting resources and a custom domain, and the only shinyapps.io option allowing for the latter is out of my price range, I am trying to host the app on a digital ocean ubuntu droplet.
I have been able to set up shiny server on my droplet using this tutorial. The sample apps work just fine. However, when I try to access my own app (having uploaded it into a directory within my shiny server) I get the following error:
An error has occurred! An error has occurred. Check your logs or
contact the app author for clarification.
I've googled for a solution and have tried moving the data cleaning steps from outside the server/ui function into the functions. I have also checked that RStudio on the droplet has all the required packages installed and that seems to be the case. I have checked the logs but there is nothing about this app or the error in the shiny server log. My app works fine both on my local computer and on shinyapps.io. I'd really appreciate any pointers (and apologies if I am duplicating but I haven't found anything that seems directly applicable).
Okay - it turns out one of the packages was indeed missing. I had installed them all using my non-root user with admin privileges, and was under the impression they were available globally. One of the packages was not available to root and installing it there resolved the problem.

Shiny app on Server: not publish it, only make it run

I am working on an Shiny app in R. My goal is to put in on a server, not on my local pc.
EDIT: my goal is not to publish it on the web, but only make it run on the server locally.
I have installed R on the server, added all the libraries I need, lastly I tried to launch my app that it is quite long, the schema is more or less this:
data preprocessing (with RODBC)
some custom functions
server<- etc.
ui<- etc.
shinyapp(server,ui)
Well in my local pc everything is fine, but on the server I cannot have a result, it is impossible to reach the address.
I decided to do something like this, create the two files called server and ui, and launching them with:
runApp(".../shiny")
Having the idea to use the option of runApp.
Well it is arriving this
ERROR: Error sourcing C:\Users\...\AppData\Local\Temp\Rtmp8YeSOV\file22281c0c2f6d
First of all, this procedure is going to help me?
If so, could you tell me what that error mean?
Thanks in advance.
I'm not sure, but I think it's not possible to reach a shiny app running in a local computer (or server). For that purpose you can use the Shiny Sever, which allow you to put your Shiny apps accessible online.
It seems that your server is a Windows computer, so your options are:
Build Shiny Server from its source code, (maybe a little difficult).
Use a virtual machine like VMware Player (free for non-commercial use) and install Ubuntu or other Linux distribution to use the pre-built binary of Shiny Server. With this option you can restrict the access to only your local network and maybe faster access to your DB's.
Use a DigitalOcean virtual server (for a very reasonable price), in this case you apps will be on the cloud and accesible everywhere.
For option 2 and 3 you can follow the very useful and well written tutorial of Dean Attali about installing and setting up a Shiny Sever. It is for DigitalOcean but is pretty much the same if you decide to use a virtual machine with Linux.
The answer is quite simple, I was using IE as browser: if you use Chrome specifying it on the runApp statement, everything works fine.

How to use R studio on a remote server

Currently, i use R studio on my desktop, with all analysis run using my desktop machine
Performance for this is really poor, so i'm getting an external server that is more powerful dedicated for R jobs
I really like the Rstudio IDE, Is there a way I can connect Rstudio on my desktop to run R on the external server?
I want to be able to use it in the same way as I use my desktop version of R, so i can view my graphs etc
RStudio Server is what you need. You can download it here:
https://www.rstudio.com/products/rstudio/download-server-2/
Install it on your external server; then from your desktop (or from any other machine!) you can connect to the server in a web browser and use RStudio inside the web browser. RStudio Server shares a great deal of code with the desktop version so the interface will be nearly identical to what you're accustomed to.
Yes, if you sign up with Amazon AWS you can use Rstudio Server and control it from your desktop pretty easily. Give this site a read and see what you can do!
http://www.louisaslett.com/RStudio_AMI/
If you have your own server at work or the university, you can install the server there and use a vm window to log in from anywhere.

Resources