我想在我的复选框中添加标题并缩进复选框,因此它们看起来像这样:
Uppercase
[] A
[] B
[] C
Lowercase
[] a
[] b
[] c
这是我的代码
letters <- c("A","B","C","a","b","c")
library("shiny")
server <-function(input, output) {
output$value <- renderPrint({ input$checkGroup })
}
ui <-fluidPage(
checkboxGroupInput("checkGroup",
label = h3("my letters"),
choices = letters,
fluidRow(column(3, verbatimTextOutput("value")))
)
runApp(list(ui = ui, server = server))
答案 0 :(得分:0)
要缩进复选框,您可以设置左边距样式。
要拥有2个群组,您只需拆分数据并制作2 checkboxGroupInput
s:
lletters <- c("a","b","c")
uletters <- c("A","B","C")
library("shiny")
server <-function(input, output) {
checkGroup <- reactive(c(input$checkGroupL,input$checkGroupU))
output$value <- renderPrint(checkGroup())
}
ui <-fluidPage(
tags$head(tags$style(HTML(".checkbox {margin-left:15px}"))),
checkboxGroupInput("checkGroupL",
label = h3("Lower case"),
choices = lletters),
checkboxGroupInput("checkGroupU",
label = h3("Upper case"),
choices = uletters),
fluidRow(column(3, verbatimTextOutput("value"))))
runApp(list(ui = ui, server = server))