0

I have a shiny app which I run it successfully on rstudio in Ubuntu.

However I user the same files in shiny-server directory and when I access the app from browser from shiny-server I get this error:

ERROR: could not find function "chartJSRadarOutput"

How is it possible to run it successfully in Rstudio but not in shiny server, what can I do?

Is it possible to check if shiny server studio can see the installed radarchart library? I have install through RStudio but I am not sure if shiny-server see them.

I user library(radarchart) and again in rstudio it runs but in shiny server gives this error:

ERROR: there is no package called ‘radarchart’
Niemik
  • 73
  • 8

1 Answers1

0

It appears you do not have radarchart library installed on your shiny server

You could use the following code to try and load the library on the server, if the library is not installed, it will attempt to install it

lapply(c('radarchart'), function(package) {
  if(!require(package, character.only = TRUE)) {
    tryCatch({
      install.packages(package)
    },
    warning = function(w) {
      NULL
    },
    error = function(e) {
      NULL
    },
    finally = {
      require(package, character.only = TRUE)
    }
    )
  }
}
)
ZeroStack
  • 1,049
  • 1
  • 13
  • 25
  • thank you. In which file I have to add the lines? i.e. in server.r file at the start of code? – Niemik Feb 16 '17 at 06:51
  • I added the code also in ui.r file, because some time it needs to see the library in both file, but now I receive this error `ERROR: there is no package called ‘package’` – Niemik Feb 16 '17 at 07:28