How to get the value in uioutput in ui.R and send it back to server.R?

前端 未结 1 1109
花落未央
花落未央 2020-12-19 16:03

In ui.R, I put:

uiOutput(\"singlefactor\")

In server.R, I have:

  output$singlefactor <- rende         


        
1条回答
  •  时光说笑
    2020-12-19 16:38

    The value will be available like any other input, for example

    library(shiny)
    
    runApp(list(ui=shinyUI(fluidPage(
      sidebarLayout(
        sidebarPanel(
          uiOutput("singlefactor")
        ),
        mainPanel(
          plotOutput("distPlot")
    
        )
      )
    ))
    ,
    server=shinyServer(function(input, output) {
         output$singlefactor <- renderUI({
        selectInput("sfactor", "Feature selection:", names(mtcars))
      })
      output$distPlot <- renderPlot({plot(mtcars[,input$sfactor])})
    
    })
    ))
    

    You created a UI element with the name "sfactor" so you can get the value with input$sfactor

    0 讨论(0)
提交回复
热议问题