![](/img/trans.png)
[英]How to use both starts_with and ends_with at the same time in one select statement?
[英]checkboxGroupButton - Select one at a time
我正在嘗試以 R shiny 中的 checkboxGroupButton() 樣式創建單選按鈕。
我想用相同的按鈕美學重新創建這個例子,但一次只允許用戶 select 一個輸入。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h1("checkboxGroupButtons examples"),
checkboxGroupButtons(
inputId = "somevalue1",
label = "Make a choice: ",
choices = c("A", "B", "C")
),
verbatimTextOutput("value1")
)
server <- function(input, output) {
output$value1 <- renderPrint({ input$somevalue1 })
}
if (interactive())
shinyApp(ui, server)
謝謝!
要創建與 R shiny 中的 checkboxGroupButton() function 具有相同按鈕美學的單選按鈕,您可以使用 radioButtons() function。此 function 允許您創建一組單選按鈕,用戶只能從 8181274用戶一次選擇一個選項 select。
所以這意味着它看起來像這樣:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h1("Radiobutton examples"),
radioButtons(
inputId = "somevalue1",
label = "Make a choice: ",
choices = c("A", "B", "C")
),
verbatimTextOutput("value1")
)
server <- function(input, output) {
output$value1 <- renderPrint({ input$somevalue1 })
}
if (interactive())
shinyApp(ui, server)
希望這可以幫助: :)
或者,如果您真的想使用復選框,則使用參數“selectize = TRUE”,例如,立即在您的參數“choices”后面使用。
想通了 - 可以簡單地通過用radioGroupButtons()
替換checkboxGroupButtons()
function 來解決
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.