[英]ShinyApps: "shinythemes" package not loading when deployed on Shinyapps.io
我正在尝试在线部署 R Shiny 应用程序。 该应用程序在本地部署时运行完美。 它基本上只是一个图表仪表板。
但是,当我在 shinyapps.io 上部署它时,该应用程序仅显示以下错误:
"ERROR: there is no package called 'shinythemes'".
我猜这意味着该应用程序的在线版本无法加载shinythemes
包,但我到处搜索,但似乎找不到任何有类似问题或解决方案的人。
这是应用程序ui.R
的代码
library(shiny)
library(shinythemes)
shinyUI(fluidPage(
theme = shinytheme("flatly"),
titlePanel("Bodhi Forest - Website Visitor Analysis"),
selectInput("user_period","Use Data from the Last",c("7 days" = "7",
"30 days" = "30",
"60 days" = "60",
"90 days" = "90"),
selected = "30"),
tabsetPanel(
tabPanel("Demographics",fluidPage(
selectInput("Dem_Dim","Dimension",c("Age","Gender")),
fluidRow(
column(12,htmlOutput("Dem_Dim"),align="center")
),
br(),
fluidRow(
column(6,htmlOutput("Dem_Sessions",inline=TRUE),align="center"),
column(6,htmlOutput("Dem_SessionLength",inline=TRUE),align="center")
),
br(),
fluidRow(
column(6,htmlOutput("Dem_Revenue",inline=TRUE),align="center"),
column(6,htmlOutput("Dem_RevenuePerTransaction",inline=TRUE),align="center")
),
br(),
fluidRow(
column(6,htmlOutput("Dem_Users",inline=TRUE),align="center"),
column(6,htmlOutput("Dem_NewUsers",inline=TRUE),align="center")
),
br(),
fluidRow(
column(6,htmlOutput("Dem_Bounce",inline=TRUE),align="center")
),
hr(),
fluidRow(
column(12,dataTableOutput("Dem_Table"))
),
hr()
)),
tabPanel("Interests",fluidPage(
selectInput("Int_Filter","",c(
"Top 5",
"Bottom 5"
)),
fluidRow(
column(6,wellPanel(plotOutput("Int_Sessions"))),
column(6,wellPanel(plotOutput("Int_SessionLength"))),
column(6,wellPanel(plotOutput("Int_Revenue"))),
column(6,wellPanel(plotOutput("Int_RevenuePerTransaction"))),
column(6,wellPanel(plotOutput("Int_Users"))),
column(6,wellPanel(plotOutput("Int_NewUsers"))),
column(6,wellPanel(plotOutput("Int_Bounce")))
),
hr(),
fluidRow(
column(12,dataTableOutput("Int_Table"))
),
hr()
))
)
))
server.R
代码没有调用shinythemes
所以我猜错误在于ui.R
但我无法弄清楚需要做什么,因为我看到其他应用程序只是调用library(shinythemes)
并且它们可以工作.
我重新更新了shiny
、 shinyapps
和shinythemes
,但无济于事。
非常感谢您对此的任何帮助! 一直试图部署这个应用程序几个小时,但似乎无法弄清楚。
这很奇怪......但我想出了最奇怪的解决方案。 不知何故,它与shinythemes
包无关! 什么?!
所以基本上,在我的server.R
代码中,我包含了DT
和rsconnect
包。 在 ui.R 代码中,我使用了hr()
和dataTableOutput()
函数。 现在......问题是这些函数包含在多个已加载的包中:
hr()
在 shiny 和 rsconnect 中。dataTableOutput()
在闪亮和 DT 中都有。 我只是在 ui.R 中的这些函数之前添加了命名空间shiny::
,如下所示:
shiny::hr()
shiny::dataTableOutput()
当我再次尝试将它们部署在闪亮的应用程序上时......哇! 该应用程序完美运行!
我很高兴我实际上浪费了一整天的时间试图弄清楚这一点,并且对解决方案与错误消息毫无关系的方式感到好笑。 希望这可以为面临同样问题的任何人节省大量时间。
仍然想知道为什么会出现这种情况以及为什么错误消息如此具有误导性……也许是闪亮的开发人员需要考虑的事情?
同意超级奇怪 - 我有一个非常相似的问题,我正在使用 DT 并且必须通过并将DT::dataTableOutput()
之类的内容附加到调用相关函数的每个部分。
我可以用shinythemes::shinytheme()
修复这个问题,当然在那之后我发现了更多的错误,但是进展顺利。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.