Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

rstudio

shiny

I recieved such error when, in created shiny app in R with DataTables packages in my mobile and one laptop. However, it didn't throw error with other laptops, Same code was working yesterday, and day before yesterday. I haven't changed code, but it is throwing error.

Why there is problem with some devices but not all devices. I used other devices, those devices are not throwing error.

Any idea how to fix this problem? The solution for this problem should be explained here http://datatables.net/manual/tech-notes/7

What is issue ?

Following is thrown error as follows:

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

like image 391
Kush Patel Avatar asked Mar 28 '16 16:03

Kush Patel


2 Answers

I am also suffering. Please take a look at the discussion of this issue #269 on Github.

It seems to be a problem post version 0.1 where you need to "flatten" variables using as.numeric.

ISSUE

Example and solution given by XD-DENG was and to quote them:

"The error is gone when I use

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

instead of:

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

The main difference is whether the column mean has additional attribution, dimension. This is what caused the error.

But it's still weird given version 0.1 of DT works perfectly on both."

PATCH

@yihui has pushed a fix for this to the dev version so please try update your DT package. (You can use package devtools to install from github devtools::install_github('rstudio/DT'))

I hope this fixes this intermittent error.

like image 71
micstr Avatar answered Sep 19 '22 15:09

micstr


I just explicitly made as.numeric() to all numeric columns within my data.frame (though they are already numeric when I do str()) and the problem is gone.

like image 41
mehakVT Avatar answered Sep 18 '22 15:09

mehakVT