是否可以将selectinput和numericinput链接到闪亮的?我希望应用程序的用户从selectInput中选择一些内容,然后输入该特定选择的值。列表中的每个变量都有一个输入的数字输入。最终,这些值将在数据表中注册。选择更多变量只需要点击一个按钮。我对闪亮的知识是有限的,这是我能够集合的,请指教。
ui <- fluidPage(
selectInput("solvent", "Choose a solvent:",
list(`Solvent` = c("ETOH", "SALINE", "DW5",'CREMOPHOR','WATER','DMSO','2% KLUCEL (pH=4 /w HCl)')
)),
actionButton('add','Add'),
numericInput('vol_ETOH','Vol ETOH (ml)',0),
numericInput('vol_SALINE','Vol SALINE (ml)',0),
numericInput('vol_DW5','Vol DW5 (ml)',0),
numericInput('vol_CREMOPHOR','Vol CREMOPHOR (ml)',0),
numericInput('vol_WATER','Vol WATER (ml)',0),
numericInput('vol_DMSO','Vol DMSO (ml)',0),
numericInput('vol_KLUCEL','Vol 2% KLUCEL (ml)',0),
textOutput("result"),
dataTableOutput('table')
)
server = function(input, output) {
rv <- reactiveValues()
observeEvent(input$solvent,{rv$data<-data.frame(vol1=input$solvent,vol=input$vol_ETOH)})
output$table<-renderDataTable({ rv$data})
output$result <- renderText({
paste("You chose", input$solvent)
})
}
shinyApp(ui, server)