My server.R contains the following code for dynamically installing packages when needed:
package <- input$chip
if (!require(package, character.only=T, qui
Unfortunately, you have to fool the shinyapps (or rsconnect) package a bit so that it does not detect package
as a literal package name. For example, you may use do.call()
:
do.call(library, list(package = package, character.only = TRUE))
The ShinyApps.io server does not allow you to install packages on the fly (strictly speaking, this is not true, but I don't want to show you how). You have to declare all packages you need in the app as dependencies beforehand. Again, it is a hack:
if (FALSE) {
library(mogene10sttranscriptcluster.db)
library(mogene20sttranscriptcluster.db)
library(hugene10sttranscriptcluster.db)
library(hgu133a2.db)
}
Then ShinyApps.io will detect these packages as dependencies and pre-install them for you. What you need to do in your app is simply load them, and you don't need to install them by yourself.