gpt4 book ai didi

r - 如何将表格添加到 Shiny 条件面板的隐藏选项中?

转载 作者:行者123 更新时间:2023-12-02 18:25:01 27 4
gpt4 key购买 nike

我正在创建一个应用程序,它有一个 checkboxInput,如果您单击它,您将有另一个选项可供选择。这些选项被 conditionalPanel 隐藏。仅当单击复选框时您才会看到它们。

image 1

但是,我想知道是否可以在这些选项中放入一些表格,因为我不希望它们具有相同的组织级别。例如:

image 2

image 3

代码:

library(shiny)


ui <- fluidPage(

titlePanel("My app"),

sidebarLayout(
sidebarPanel(
tabsetPanel(

tabPanel("Tab1",
checkboxInput("option1", "Remove...", value = FALSE),

conditionalPanel(
condition = "input.option1 == 1",
radioButtons(inputId = "type_removal", label=NULL,
choices = c("Remove 1" = "remove1",
"Remove 2" = "remove2"))),

textInput(inputId = "data2", "Data1", value = "data")),

tabPanel("Tab2",
textInput(inputId = "data", "Data1", value = "data")
),

)
),

mainPanel(

)
)
)


server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

可以在 Shiny 中实现吗?

提前非常感谢

问候

最佳答案

您可以将内联样式添加到条件面板:

             conditionalPanel(
condition = "input.option1 == 1",
style = "margin-left: 100px;",
radioButtons(inputId = "type_removal", label=NULL,
choices = c("Remove 1" = "remove1",
"Remove 2" = "remove2"))),

关于r - 如何将表格添加到 Shiny 条件面板的隐藏选项中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70347539/

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