R闪亮:如何在过滤器中以升序显示值

问题描述 投票:0回答:2

如何在过滤器中以升序显示值。

想要在dataTableOutput中显示星期的过滤器,其值按升序排列。

这里是ui.R]的代码>

fluidPage(
  titlePanel("Delivery Assurance Matrix"),
  fluidRow(
    column(4,

           selectInput("week_count",
                       "Week",
                       c("All",
                         sort(unique(as.character(data$Week))))
    ))),
 DT::dataTableOutput("table")
)

这里是server.R

]的代码>
function(input, output) {
output$table <- DT::renderDataTable(DT::datatable({
    data<-data
    if (input$week_count != "All") {
      data <- data[data$Week >= input$week_count,]
    }

    data
}))

}  

但是在UI值中不按顺序enter image description here

enter image description here

如何在过滤器中以升序显示值。要在dataTableOutput中显示星期的过滤器,其值按升序排列。这是ui.R fluidPage(titlePanel(“ Delivery ...

r datatable shiny shinydashboard
2个回答
0
投票

此更改解决了。

fluidRow(
    column(4,

           selectInput("week_count",
                       "Week",
                       c("All",
                         order(sort(unique(as.character(data$Week)))))
    ))

0
投票

您也可以选择具有shinyWidgets选件的Select All软件包

© www.soinside.com 2019 - 2024. All rights reserved.