更新时间:2023-02-18 12:04:22
该值将像任何其他输入一样可用,例如
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])})
})
))
您创建了名为"sfactor"的UI元素,因此可以使用input$sfactor