I've created a Shiny app that runs perfectly when I run it in my computer (I have the "ui.R" and "server.R" files in a directory of my desktop).
But I want to other people in my workplace (also using R and RStudio) can also run it.
I copy the "ui.R" and "server.R" files to a directory in another computer, so anyone with the permissions can access this app.
The problem is that when I move this files to other computer's folder I can't run the app anymore. It gives me the error "No Shiny application exists at the path..."
I set the working directory to this new path where I put the files, so I don't know where the problem is. I have lecture and writing permissions to this folder.
I'm using Windows 7.
A much easier way would be keep server.R and ui.R in one script without copying to a specific area.
shinyApp(ui = ui, server = server)
Related
[Sorry, newbie here!]
I've just installed R server, shiny server on an ubuntu EC2 instance. I have left the shiny-server.conf intact, except that I added: preserve_logs true;. The sample app was working fine.
I have removed /srv/shiny-server/index.html and /srv/shiny-server/sample-apps.
I have linked my app files from my /home/myapp directory to /srv/shiny-server/myapp. The app files consists of a single apps.R, a footer.html, and a small dataset .Rds, and a www/style.css file.
When I navigate to http://[myip]:3838/ the only thing is the directory listing; the only folder is : myapp. When I click to http://[myip]:3838/myapp/ , I see the directory listing as well. That is, I see the content, and I can download each of them. BUt I see no evidence of the app running. If I click on apps.R, my browser downloads the file.
PS: the app works fine when tested in Rstudio, or deployed on Shinyapps.io
If anyone from the future reads this, I wish you heard the loud headslap when I realized my app single-file should be called app.R, not apps.R (which makes a lot of sense in retrospect).
I have 3 files which are needed to my app.
First a general r with functions make some calculations and need to load the ui and server files to run the app.
When I run it on Rstudio it works fine. How is it possible to insert this app to shiny server, meaning that I need first a script and after that run the ui and server files?
Use a global.R file or use source(file, local = FALSE) to read R Code from a file.
For more details check the scoping rules.
I have created my first Shiny app and i want to share it with people.
I have a folder which contains my ui.R file and my Server.R file.
I have managed to get a server for it and install Shiny Server and it runs pretty well. In fact I have written the shiny app in the web browser.
My question is where do I save the scripts on the shiny server so that I can send the link to people and it will just load up as a website (assuming they have credentials?
Thank you for your time.
I found another question similiar to the one i was looking for.
Hosting LAN Shiny apps run from command line
This answers the question by specifiying that i should move my test scripts into production by saving them /srv/shiny-server/myApp
Which server do you use? Perhaps AWS (Amazon)? Then you can upload it in one of the folders on your server. In the case of Amazon, you do it through S3 Browser.
You can use a domain name to redirect you to the specific folder where you keep your shiny apps. Each shiny app should have its own sub-directory where you keep server and ui scripts. Then you load your shiny name like this:
yourdomain.com/sub_directory_where_shiny_script_are_located
Don't forget to adjust your directories in the script, so that when you load any data, it loads the data located on ubuntu server, for example.
if(Sys.info()[['user']] %in% c("ubuntu","shiny") ) {
load("/a2cka/ShinyApps/sub_directory_shin_app_/data.csv}
I'm working on loading up a Shiny App IO. I use an R package that downloads data into a subfolder in my directory and saves two .RData files.
I'm having issues on the Shiny App IO server. I need to load the two .RData files. Locally, I can set the relative path using (~project/source-data). Shiny App does not respond to this.
I can set it as a working directory using a relative path, (./source-data), however, this is not ideal as I have further data manipulation to do at the parent level directory and I can't seem to set the working directory back to the parent level in Shiny App.
Here is what I had moved forward with:
wd = getwd()
sd = (paste(getwd(),"/source-data",sep=""))
sd2 = list.files(sd, full.names = TRUE)
file.copy(from=sd2, to=wd)
My solution, although not ideal, is to copy the two .RData files to the parent directory. At that point, the rest of my code will run smoothly. It works locally, but not on Shiny App.
Does anyone have experience with a similar problem and solution? Either helping me direct the Shiny App IO server to the sub-directory and back to the parent directory once I load in the two .RData files, or copying the files to the parent directory?
I've seen solutions that work on a local R environment, but not one that satisfies the conditions of a Shiny App IO server environment.
Thank you in advance.
I'm deploying my shiny app and I don't know how to input my a local dataset. I keep getting Error: object "data" not found. Here is my path to shiny folder.
library(shinyapps)
shinyapps::deployApp('C:\\Users\\Jeremy\\Desktop\\jerm2')
In this directory (jerm2), I have 3 things: ui.R, server.R, and my local dataset, a .csv called proj.csv.
In the server.R file,
I set data<-read.csv("proj.csv")
I just don't know how to get Shiny to pick up my datasets.
You may want to add a subdirectory in your shiny folder called "Data" and put proj.csv there.
Then, in your server.r put:
data<-read.csv("./Data/proj.csv")
That will make it clear where the data is when the app is deployed to the ShinyApps service.
I ran into this same problem. It turned out that I did not have my working directory pointing to my shiny app at the time I used shiny.io to save and deploy my app.
Be sure that if you're loading the data that the code reflects that your shiny app is the working directory.
Otherwise you will get a log error that looks something like this
cannot open compressed file 'C:/Users/Joseph/Documents/data/data.rda', probable reason 'No such file or directory'
What I did was to write the csv under a sub folder (i.e. data/) of the shiny app directory and then added data<-read.csv("/Data/proj.csv") in server.r (as indicated in the answer). I didn't put the dot and it works.
Another thing is, when you publish it, don't forget to publish both the shiny app and the file in the shiny app folder.