plotly 未安装在 shiny-server 中
plotly not installed in shiny-server
当我在 shiny-server 中使用 plotly
库时,我遇到了以下问题:
应用程序在 RStudio Server 中使用“运行 App”命令可以正常工作,但是当部署在 shiny-server:3838 上时会出现以下错误 Error in library(plotly) : there is no package called ‘plotly’ Calls: runApp ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library Execution halted
似乎 plotly
库由于某种原因没有安装在 shiny-server 中,尽管它已安装并适用于 RStudio Server。有谁知道如何解决它。
我最初认为这可能是我的代码有问题,但如果我使用 plotly-r 网站提供的代码示例,我实际上可以复制完全相同的问题 here
要复制的代码如下:
library(shiny)
library(plotly)
ui <- fluidPage(
selectizeInput(
inputId = "cities",
label = "Select a city",
choices = unique(txhousing$city),
selected = "Abilene",
multiple = TRUE
),
plotlyOutput(outputId = "p")
)
server <- function(input, output, ...) {
output$p <- renderPlotly({
plot_ly(txhousing, x = ~date, y = ~median) %>%
filter(city %in% input$cities) %>%
group_by(city) %>%
add_lines()
})
}
shinyApp(ui, server)
以前有人遇到过这个问题吗?
运行 在安装闪亮服务器的机器上。这将安装 plotly 包。
sudo su - -c "R -e \"install.packages('plotly', repos='http://cran.rstudio.com/')\"
当我在 shiny-server 中使用 plotly
库时,我遇到了以下问题:
应用程序在 RStudio Server 中使用“运行 App”命令可以正常工作,但是当部署在 shiny-server:3838 上时会出现以下错误 Error in library(plotly) : there is no package called ‘plotly’ Calls: runApp ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library Execution halted
似乎 plotly
库由于某种原因没有安装在 shiny-server 中,尽管它已安装并适用于 RStudio Server。有谁知道如何解决它。
我最初认为这可能是我的代码有问题,但如果我使用 plotly-r 网站提供的代码示例,我实际上可以复制完全相同的问题 here
要复制的代码如下:
library(shiny)
library(plotly)
ui <- fluidPage(
selectizeInput(
inputId = "cities",
label = "Select a city",
choices = unique(txhousing$city),
selected = "Abilene",
multiple = TRUE
),
plotlyOutput(outputId = "p")
)
server <- function(input, output, ...) {
output$p <- renderPlotly({
plot_ly(txhousing, x = ~date, y = ~median) %>%
filter(city %in% input$cities) %>%
group_by(city) %>%
add_lines()
})
}
shinyApp(ui, server)
以前有人遇到过这个问题吗?
运行 在安装闪亮服务器的机器上。这将安装 plotly 包。
sudo su - -c "R -e \"install.packages('plotly', repos='http://cran.rstudio.com/')\"