gpt4 book ai didi

shiny - 使用selectInput设置框标题?

转载 作者:行者123 更新时间:2023-12-04 19:58:08 26 4
gpt4 key购买 nike

我想使用 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)

最佳答案

只需更换 renderPrintrenderText :

server <- function(input, output) {
output$Design <- renderText({
paste(input$Design, 'settings')
})
}

关于shiny - 使用selectInput设置框标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31250839/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com