I am trying to create a web application using shiny. It requires me to load a package I have installed on my computer. For example:
## Contents ui.R:
library(shiny)
library(plyr)
shinyUI(pageWithSidebar(
headerPanel("Hello Shiny!"),
sidebarPanel(
sliderInput("obs",
"Number of observations:",
min = 0,
max = 1000,
value = 500)
),
mainPanel(
plotOutput("distPlot")
)
))
## Contents server.R:
library(shiny)
library(plyr)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# generate an rnorm distribution and plot it
dist <- rnorm(input$obs)
hist(dist)
})
})
This works fine if I run it locally (using runApp
) but when I try to run it via my server (same computer) I get the error that the plyr
package (or any other package I try to use this way) is not installed. How could I use extra packages in shiny server?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…