【问题标题】:Shiny DT package filter warning闪亮的 DT 包过滤器警告
【发布时间】:2015-09-28 04:50:24
【问题描述】:

我正在使用 DT 包在 Shiny 中制作应用程序。感谢其他建议,它运行良好,但是当我包含过滤器参数(默认为“无”)时,我收到下一条消息:

运行中的警告(timeoutMs): min 没有不可缺少的参数;返回 Inf 运行中的警告(timeoutMs): max 没有非缺失参数;返回 -Inf

我什至在上传文件之前就收到了这条消息,所以我认为问题可能出在 read.table 参数中,但我找不到解决方案。这是代码:

Ui.r

library(shiny)
library(shinythemes)
library(DT)

shinyUI(fluidPage(theme = shinytheme("Journal"),

 fileInput("FileInput", "Choose file 1"),


 DT::dataTableOutput("table"))

server.r

library(shiny)
library(DT)

shinyServer(function(input, output, session) {

  datasetInput <- reactive({
    infile <- input$FileInput
    if(is.null(infile))
      return(NULL)
    read.table(infile$datapath, header = TRUE, sep="")

  })

  output$table = DT::renderDataTable(
    datasetInput(),
    filter='top',
    extensions = c('TableTools','ColVis'), 
    options = list(dom = 'TC<"clear">ftir',
                   tableTools = list(
                     "sSwfPath" =     "//cdnjs.cloudflare.com/ajax/libs/datatables-    tabletools/2.1.5/swf/copy_csv_xls.swf",
                     "aButtons" = list(
                       "copy",
                       "print",
                       list("sExtends" = "collection",
                            "sButtonText" = "Save",
                            "aButtons" = c("csv","xls")))),
                   ColVis = list(activate= "click", align = "right"))

  )})

此外,当我上传文件时(尽管包含过滤选项的警告),范围滑块不允许您选择间隔,只能选择不同的行值(抱歉,我还不能上传文件:)

【问题讨论】:

    标签: r filter datatable shiny dt


    【解决方案1】:

    此问题已在 DT (>= 0.1.16) 的 current development version 中出现 fixed。您的数据中必须有一列缺少所有值 (NA),在这种情况下 DT 将禁用过滤器,因为过滤 @987654324 的完整列没有任何意义@s.

    【讨论】:

    • 感谢您的帮助@Yihui,当我运行应用程序时仍然会出现警告,但我已经解决了范围滑块问题,在 read.table 行中添加参数“dec”以指定哪个是文件中用于小数点的字符。
    猜你喜欢
    • 2018-10-04
    • 2016-08-18
    • 2016-10-25
    • 2020-09-18
    • 2018-02-13
    • 1970-01-01
    • 2021-02-06
    • 2013-06-15
    • 2017-11-09
    相关资源
    最近更新 更多