No data.tables package

Just deployed an app to shinyapps.io and the app launches but greys out. The error I see in the log is pasted below related to "no package called data.table". The app runs fine locally and also runs fine with shiny server pro on system we have on premises.

I am not calling "data.table::" anywhere, but am using the function data.table() in many places (hundreds of places). The log doesn't give details enough to track down where the actual culprit is in code and my code is many thousands of lines. I can grep and see where data.table() is called throughout.

Below is a snippet from the log. Any advice for resolution?

2022-01-15T20:13:11.665668+00:00 shinyapps[5447651]: Warning: Error in FUN: there is no package called ‘data.table’
2022-01-15T20:13:11.700371+00:00 shinyapps[5447651]: Error in FUN(X[[i]], ...) : there is no package called ‘data.table’
2022-01-15T20:13:11.700199+00:00 shinyapps[5447651]: 71:

I was able to resolve this and am documenting for others. For background, my app is huge and in order to make it scale it is broken down into many subcomponents that are sourced in. For those familiar with Flask, it's like the concept of Blueprints to grow an app easily and manage code.

One piece of code that is grabbed in my app is the "libPack.R" which is all of the packages that are needed..

Locally (and on shiny server on premises), I just use an lapply and add to the package list as follows:

#Packages <- c("data.table", "plyr", "dplyr", "sqldf", "lattice", "latticeExtra", "stringr", "statmod", "gridExtra", "readr", "R.methodsS3", "Matrix", "nlme", "foreach", "doParallel", "RODBC", "ggplot2", "readxl", "corrplot")

#lapply(Packages, library, character.only = TRUE)

For some reason, this does not work when deployed at apps.io. Instead, I had to explicitly call each library as follows:

library(data.table)
library(lattice)
library(gridExtra)
library(latticeExtra)
library(plyr)

Hope this is helpful to others as they build and deploy.

Thanks. Would you mark this as solved?

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.