0
library(shiny)
shinyUI(fluidPage(
# Application title
titlePanel(h1("TEST", align = "center", style = "color:red")),
tabsetPanel(
tabPanel("Marketing",sidebarLayout(
sidebarPanel(textInput("id",label = "Enter consultant Name"),
selectInput('s1','Select Names',choices = c('i','ij','ishu','ishan'),selected = NULL),
actionButton("a","Submit")
),
mainPanel(
textOutput('out'),
textOutput("sout")
)
)
),
tabPanel("Recruitment",sidebarLayout(
sidebarPanel(textInput("id1",label = "Enter consultant Name"),
actionButton("a1","Submit")
),
mainPanel(
textOutput('out1')
)
)
),
tabPanel("Engineering",sidebarLayout(
sidebarPanel(textInput("id2",label = "Enter consultant Name"),
actionButton("a2","Submit")
),
mainPanel(
textOutput('out2')
)
)
),
tabPanel("Finance",sidebarLayout(
sidebarPanel(textInput("id3",label = "Enter consultant Name"),
actionButton("a3","Submit")
),
mainPanel(
textOutput('out3')
)
)
),
tabPanel("Legal",sidebarLayout(
sidebarPanel(textInput("id4",label = "Enter consultant Name"),
actionButton("a4","Submit")
),
mainPanel(
textOutput('out4')
)
)
),
tabPanel("Test",
mainPanel(
tableOutput('table')
)
)
)
)
)
庫(閃亮)selectInput不工作
shinyServer(function(input, output) {
observeEvent(input$a,
output$out <- renderText(
input$id),
output$sout <- renderText(input$s1)
)
observeEvent(input$a1,
output$out1 <- renderText(
input$id1
)
)
observeEvent(input$a2,
output$out2 <- renderText(
input$id2
)
)
observeEvent(input$a3,
output$out3 <- renderText(
input$id3
)
)
observeEvent(input$a4,
output$out4 <- renderText(
input$id4
)
)
output$table <- renderTable(read.csv('csv1.csv'))
})
在這個程序,我想從selectInput功能,只要與ID 「A」 actionbutton用戶點擊名稱。我試圖在observeEvent()函數下執行此操作,但得到錯誤: - 「eval:invalid'envir'參數的類型爲'closure'」。請幫助 在此先感謝
它的工作,非常感謝。 –