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

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
}

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!

Shiny App doesn't work while accessing on remote computer

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)

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.

Running R code via Rstudio on a remote server not by browser

Is there a way to use a local Rstudio installation on my machine which is actually running the code on a remote server where I can run distributed jobs via SLURM?
Can it be compatible with version control and dockers?
The remoter package does what you are wanting to do very well. You start R on the remote server and run remoter :: server(showmsg=TRUE). Then in you local RStudio you run
remoter :: client (). Works fairly flawlessly.
My main issue is that when you run help it comes from the remote session in the console rather than the help window.
https://cran.r-project.org/web/packages/remoter/vignettes/remoter.pdf

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.

Resources