我正在尝试将图像放入ShinyApp的infoBox
中。
我收到此错误:
shinyUI(dashboardPage,dashboardHeader(“ ABC”))中的错误, dashboardBody(fluidPage(h1(“ type”),:未使用的参数 (dashboardHeader(“ ABC”),dashboardBody(fluidPage(h1(“ type”), mainPanel(tabsetPanel(tabPanel(h1(“ summary”),infoBox(“ BCD”,a, div(img(src =“ ribbon.PNG”,width = 100),style =“ text-align: 中心;“)))))))))
代码:
library(shiny)
library(shinydashboard)
a = 45
ui < - shinyUI(dashboardPage,
dashboardHeader("ABC"),
dashboardBody(fluidPage(h1("type"),
mainPanel(
tabsetPanel(
tabPanel(h1("summary"),
infoBox("BCD", a, div(img(src = "ribbon.PNG",
width = 100), style = "text-align: center;"))))))))
server <- shinyServer({})
shinyApp(ui, server)
有人可以帮我吗?
答案 0 :(得分:0)
在img.png
文件夹中设置图片www
,然后下面的代码起作用:
library(shiny)
library(shinydashboard)
a <- 45
ui <- shinyUI(
dashboardPage(
dashboardHeader(title = "ABC"),
dashboardSidebar(),
dashboardBody(
fluidPage(
infoBox("BCD", a, div(img(src = "img.png", width = 100), style = "text-align: center;"))
)
)
)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)