I am trying to upload a shiny app to shinyapp.io. If I run the commands locally, it works fine, but clicking 'Run App' in RStudio or uploading it to shinyapp.io gives an issue. I have located the offending issue to be a failure run library(survival). While I know shinyapp.io likes to use the CRAN repository, I believe this package to be on CRAN, which leaves me mighty confused. I see the package using available.packages() but not necessarily on https://cran.r-project.org/web/checks/check_summary_by_package.html. If the key is through rsconnect::appDependencies(), it appears there are too many files despite the minimal code run below:
Thanks for your help! It looks like the error was a bit further down. I've added it in conjunction with your code syntax. It looks like the error is associated with survminer::ggsurvplot() claiming that:
Error in FUN(X[[i]], ...) : object 'the_survival' not found
However, if I run the lines of code, it works!Just the 'Run App' and deployment appears to fail.
I would guess ggsurvplot needs ggplot, based on its name.
It's in the list of installed packages on your local computer, but when uploading it to shinyapps.io it doesn't recognise this dependency.
Try to add ggplot2 to the libraries and check if it's working afterwards.
Not super clear to me whats happening, as I havent tried to deploy, but the runApp button on your version of the code does execute for me and show me a chart....
If I had to guess though, I'd look here:
I would think that the problem is probably with this syntax.
normally in a function that allows formulas, you would either construct the formula from independent elements fit1 <- survfit(the_survival ~ simple_patient$event)
and not pass a data parm that serves no purpose....
or else, you use the data parm, but you make sure that the forumula variables you want to use are in that data object
I can't vouch for this being the reason, as its not an impediment for my R session to run your code as it is.... but I would check this out for yourself
Thanks for the reply. I've re-installed RStudio, but still no luck. Running it in regular R works (locally), but the server deploy has the same issue that RStudio reports as if I had clicked the 'Run App' button. It appears if I run the code and then click the 'Run App' button, it works (locally), but won't deploy to shinyapp. If I clean my environment, it won't run again (locally).
Since the demo code I posted above wasn't working, I took the code directly from the tutorial site and it still doesn't work. This must be some environment issue? Any suggestions to get around it? I'm about ready to forfeit shiny if the same code on two machines works differently.
If I save the file as app.R to get the Run App button in Rstudio, then I can confirm the code you shared just now fails with the same object error missing.
However, the fix seems to be along the lines I suggested, as with these modifications the Run App button works without errors
I was hoping patients could upload the molecular features and get predictions, such as survival and predicted response to treatment, but the 1g RAM ceiling is mighty hard to deal with. As of now, it's only a very simple glm.