6

我想使用 selectInput 在框上设置标题。例如,我希望默认标题为:名称 2 设置

现在,我可以将标题设为[1] "Name 2 settings". 有没有办法删除[1]和引号?

谢谢!

这是我的示例应用程序:

## app.R ##
library(shiny)
library(shinydashboard)

ui <- dashboardPage(dashboardHeader(),
                    dashboardSidebar(),
                    dashboardBody(fluidRow(
                      box(
                        title = "Settings", width = 6, solidHeader = TRUE, status = "primary",
                        flowLayout(selectInput(
                          "Design", "Design:",
                          c("Name 1" = "Name 1",
                            "Name 2" = "Name 2"),
                          selected = "Name 2"
                        ))
                      ),
                      box(
                        title = textOutput("Design"), width = 4, solidHeader = TRUE, status = "primary",
                        "Box content"
                      )
                    )))
server <- function(input, output) {
  output$Design <- renderPrint({
    paste(input$Design, 'settings')
  })
}

shinyApp(ui, server)
4

1 回答 1

4

只需替换renderPrintrenderText

server <- function(input, output) {
    output$Design <- renderText({
        paste(input$Design, 'settings')
    })
}
于 2015-07-06T16:27:14.510 回答