Вам нужно будет обернуть их в list()
, чтобы это сработало:
library(shiny)
library(shinydashboard)
library(shinyBS)
writeLines(text = 'myPopovers = list(
bsPopover(
id = "one", title = "ONE",
content = "blah blah blah 1",
trigger = "hover",
placement = "right",
options = list(container="body")),
bsPopover(
id = "two", title = "TWO",
content = "blah blah blah 2",
trigger = "hover",
placement = "right",
options = list(container="body")),
bsPopover(
id = "three", title = "THREE",
content = "blah blah blah 3",
trigger = "hover",
placement = "bottom",
options = list(container="body"))
)', con = "helper.R")
source("helper.R")
ui <- dashboardPage(
dashboardHeader(title = "Value boxes"),
dashboardSidebar(),
dashboardBody(
fluidRow(
valueBoxOutput("one"),
valueBoxOutput("two"),
valueBoxOutput("three"),
myPopovers
)
)
)
server <- function(input, output) {
output$one <- renderValueBox({
valueBox(
"25%", "Progress", icon = icon("list"),
color = "purple"
)
})
output$two <- renderValueBox({
valueBox(
"80%", "Approval", icon = icon("thumbs-up", lib = "glyphicon"),
color = "yellow"
)
})
output$three <- renderValueBox({
valueBox(
"90%", "Approval", icon = icon("thumbs-up", lib = "glyphicon"),
color = "green"
)
})
}
shinyApp(ui, server)
Результат: