我正在尝试为所选列创建一个表 选择输入。 updateSelectInput用于根据所选条件获取框中的值。 但是,rendertable不会在数据集上创建正确的表。
ui.R
selectInput('pick_recon',
label = 'Select Recon',
choices = unique(as.character(my_data$ReconIdName)),selected = "A", multiple = FALSE),
selectInput('pick_status',
label = 'Select Status',
choices = NULL),
selectInput("pick_rundate","Select Run Date",choices = NULL),
dataTableOutput("issuesbyReconName"),
server.R
observe({
#print(input$pick_recon)
x <- my_data$Status[my_data$ReconIdName == input$pick_recon]
updateSelectInput(session,"pick_status","Select Status",choices = unique(x))
})
observe({
rundate <- my_data$RunDate[my_data$Status == input$pick_status]
updateSelectInput(session,"pick_rundate","Run Date",choices = rundate)
})
filterData <- reactive({
my_dataframe[which(my_dataframe$rundate == input$pick_rundate),]
print(filterData)
})
output$issuesbyReconName <- renderDataTable({
datatable(filterData(),selection="single",rownames = F)
})
renderdatatable未在所选条件下填充正确的表。 你能帮我解释一下这段代码的数据框创建部分吗?
谢谢,