DataTable warning table ajax error for some people but not all with shiny

DataTable warning table ajax error for some people but not all with shiny

当我在我的手机和一台笔记本电脑中使用 DataTables 包在 R 中创建闪亮的应用程序时,我收到了这样的错误。但是,它并没有在其他笔记本电脑上引发错误,昨天和前天都在使用相同的代码。我没有更改代码,但它抛出错误。

为什么有些设备有问题,但不是所有设备。我使用了其他设备,那些设备没有抛出错误。

知道如何解决这个问题吗?这个问题的解决方法应该在这里解释http://datatables.net/manual/tech-notes/7

什么是问题?

下面抛出错误如下:

DataTables warning: table id=DataTables_Table_0 - Ajax error. For more information about this error, please see http://datatables.net/tn/7

我也很痛苦。请看一下这个issue #269 on Github的讨论。

post 版本 0.1 似乎有问题,您需要使用 as.numeric.

"flatten" 变量

问题

XD-DENG 给出的示例和解决方案是并引用它们:

“当我使用

时错误消失了
temp <- tapply(iris$Sepal.Length, iris$Species, mean)
  result <- data.frame(species = names(temp),
                       mean = as.numeric(temp))
  return(result)

而不是:

temp <- tapply(iris$Sepal.Length, iris$Species, mean)
  result <- data.frame(species = names(temp),
                       mean = temp)
  return(result)

主要区别在于列平均值是否具有附加属性、维度。这就是导致错误的原因。

但考虑到 DT 的 0.1 版在两者上都能完美运行,这仍然很奇怪。"

补丁

@yihui 已将此修复推送到开发版本,因此请尝试更新您的 DT 包。 (您可以使用软件包 devtools 从 github devtools::install_github('rstudio/DT') 安装)

我希望这能修复这个间歇性错误。

我只是明确地对我的 data.frame 中的所有数字列进行了 as.numeric() (尽管当我执行 str() 时它们已经是数字)并且问题消失了。