R shiny and rscript.exe - r

I have tried to make use of a .bat in windows to open and run an r shiny app.
It all works and I even get the listening prompt displayed.
However, no web interface opens.
Has anyone else met this problem and resolved it?

Related

How to run a shiny app in IntelliJ (PyCharm)

I have a basic shiny app (ui.r and server.r) that I am able to run in RStudio.
But seems like I can't run it in IntelliJ.
I have installed the R language support plug-in and I can run r scripts.
But when I try to run ui.r, the only thing I get is html output in the console.
Does anyone recognise this? I probably forgot to configure something?
I do have experience running java (web) apps with IntelliJ. With tomcat setup e.g.
In the run configurations, I didn't see anything specific for a shiny server or something R related. So I guess that is not where I should search ...
Any idea? Is more information needed?
Thx in adavance.
edit:
The answer is here: https://youtrack.jetbrains.com/issue/R-895
To run a shiny App (R framework) on PyCharm you must enable R first and indicate where is the R interpreter located:
R options appears on the bar status. One of them is R Console. Click on it. Write getwd() command to see if you are in the root directory of the project. If not, set it with setwd() command:
Next, write runApp() and DO NOT press enter yet. You must press alt+enter and then click on load Shiny:

Shiny application started with Rscript and CMD is unavailable after time

I have a small .bat script that runs an app using "Rscript" when the user logs in. After some time, the application / server becomes unavailable. There is no error, the page only loads for forever. When the app is started manually through RStudio there is no problem with the access to the app even after days of running. Any idea what causes this and how to solve it?
I think this will help you. It is supposed to be the correct way to launch a R Shiny app.
R -e "shiny::runApp('~/shinyapp')"
(1st result on Google ... Pardon my tone, but have you searched for this before to ask Stackoverflow how to deal with this problem?)

How to run R shiny app by clicking on file without opening mac's terminal

I have coded an app with R and Shiny. I have also created the file with the code below so that the app runs when I double click on the app file.
cd ~/Dropbox\ \(Centeo\ ApS\)/0.Raportering/
R -e "shiny::runApp('ignore.R', launch.browser=TRUE)"
Everything so far works perfectly.
The only issue I have is that, when I double click on the app file to run the app, the Mac's terminal opens and stays open til I close the app.
So my question is: is there a way I can modify the code above so that the terminal windows does not open?
Thanks in advance!

Script using GPU throws error when running app on Shiny server

I have written some code in R using the Shiny package. The app runs alright when running shiny::runApp() from RStudio.
I've tried to host the app on a Shiny server and the GUI starts up correctly. However, a plot should appear on the right when the button "Enviar informacion" is clicked. (You can see how the app looks here, but it won't work though because that link is not on Shiny server but on Shinyapps.io).
The relevant part of the logfile is the following:
Listening on http://127.0.0.1:38327
Loading required package: Rcpp
Warning: Error in [: subscript out of bounds
211: FUN [/srv/shiny-server/spike_sorting/server.R#82]
210: apply
209: cluster_som_h [/srv/shiny-server/spike_sorting/server.R#82]
...
So the error is inside the function cluster_som_h. After trying some stuff, I found out what is causing the error, but don't know how to fix it. Inside this function, I make use of the function Rsomoclu.train() from the package Rsomoclu, with kernelType = 1. This means that the function is run on the GPU. If I set kernelType = 0, then the app works okay with both runApp() and from the Shiny server. So that's where the problem is: for some reason, running the function on the GPU is not working if the app is run from the Shiny server, but it does work if it is run from RStudio using runApp().
Maybe there is something going on because I have CUDA installed on my computer but when I try to run it from the server something happens. Is there a way to fix this? I believe running the code from this specific computer no matter where on the LAN the app is run would solve this. Is this possible?
After doing some (basic) research, I found out what was happening. I have CUDA installed only in my user in Ubuntu, so I had to change the first line of the file /etc/shiny-server/shiny-server.conf so that the user was the right one:
# Instruct Shiny Server to run applications as the user "my_name"
run_as my_name;

Fatal error when deploying a shiny app with Rstudio

I have a shiny app (divided into ui.R, server.R and helpers.R) which works on my local machine. The app does not load any libraries besides library(shiny). I am unable to deploy it to shinyapps.io. That is what I do
I log myself into shinyapps.io (via the website www.shinyapps.io)
I run library(rsconnect) on the R console.
I copy the Tokens code (rsconnect::setAccountInfo...) from the www.shinyapps.io page into the R console and run it.
I run the app in Rstudio (1 warning: Warning in body(fun) : argument is not a function). The app runs as expected.
I use the "publish" button in the app window and get a new window saying: "R session aborted. R encountered a fatal error. The session was terminated"
Sorry, I have no idea about where to look for the error. Can you give me a hint what causes the problem? Which additional information would you need to help me?
Thanks a lot!
update: I just saw that there is a second "publish"-button in Rstudio if you have one of the app-files in the editor (without running it). When I use this one, I get the same crash, but with some more information: unexpected exception: boost::filesystem::unique_path: key is not valid in specified status (sorry, that is my own translation from German).
One way of deploying an app to the shinyapps.io server is not to use the button in RStudio, but to do it via the console. Here the steps that are working for me now (RStudio 1.0.143):
Log in on shinyapps.io (via the website www.shinyapps.io)
Run library(rsconnect) on the R console.
Copy the Tokens code (rsconnect::setAccountInfo...) from the www.shinyapps.io page into the R console and run it.
Run rsconnect::deployApp('path to your app') on the R console.
Pushing the publish button in RStudio still results in a crash of R.

Resources