【问题标题】:Modify a UI input reactively in RShiny [duplicate]在 RShiny 中反应性地修改 UI 输入 [重复]
【发布时间】:2017-11-13 10:26:08
【问题描述】:

这是我的示例 UI:

library(shiny)
ui <- fluidPage(

    titlePanel("Carry Selector"),
    sidebarPanel(
        fluidRow(
            column(6,numericInput(inputId = 'legNumbers',label = 'Number of Legs',min = 1,max=4,step=1,value=2))
        ),
        tags$hr(style="border-color: black;"),
        fluidRow(
            column(6,numericInput(inputId = 'weight1Input',label = 'Weight',min = 0,max=10,step=0.25,value=1))
        )
    ),
    mainPanel(
    )
)

我希望我的第二个输入完全模仿我的第一个输入,但不知道如何去做。

当然,我的最终目标是让其他一些输入对多个先前输入的选择做出反应,但这是我的问题的浓缩版本。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    想通了:

    ui <- fluidPage(
    
        titlePanel("TEST"),
        sidebarPanel(
            fluidRow(
                column(6,numericInput(inputId = 'legNumbers',label = 'Number of Legs',min = 1,max=4,step=1,value=2))
            ),
            tags$hr(style="border-color: black;"),
            uiOutput("ui_test")
        ),
        mainPanel(
        )
    )
    
    
    server <- function(input,output){
        output$ui_test <- renderUI({
            fluidRow(
                column(6,numericInput(inputId = 'weight1Input',label = 'Weight',min = 0,max=10,step=0.25,value=input$legNumbers))
            )
        })  
    }
    

    【讨论】:

      猜你喜欢
      • 2019-06-08
      • 2017-10-07
      • 2018-10-22
      • 2021-01-06
      • 2019-12-16
      • 1970-01-01
      • 2020-09-13
      • 2020-09-18
      • 2018-05-20
      相关资源
      最近更新 更多