我在页面上有可能在列中排序的表,在我重新加载数据表之后没有再次排序,这里是代码:
library(shiny)
shinyServer(function(input, output) {
# Return the requested dataset
datasetInput <- reactive({
switch(input$dataset2,
"[,...]" = diamonds,
"[10:30,...]" = diamonds,
"[31:50,...]" = diamonds)
})
#"[,...]" = diamonds[,],
#"[10:30,...]" = diamonds[10:30,],
#"[31:50,...]" = diamonds[31:50,])
# Show the first "n" observations
output$view <- renderTable({
head(datasetInput())
})
# a large table, reative to input$show_vars
output$mytable1 <- renderDataTable({
library(ggplot2)
datasetInput()[, input$show_vars, drop = FALSE]
}, options = list(stateSave = TRUE))
})