I am in the process of creating a package that uses a data.table as a dataset and has a couple of functions which assign by reference using :=.
Another solution is to use inst/extdata to save the rda file (which would contain any number of data.table objects) and have a file DT.r within the data subdirectory
# get the environment from the call to `data()`
env <- get('envir', parent.frame(1))
# load the data
load(system.file('extdata','DT.rda', package= 'foo'), envir = env)
# overallocate (evaluating in correct environment)
if(require(data.table)){
# the contents of `DT.rda` are known, so write out in full
evalq(alloc.col(DT), envir = env)
}
# clean up so `env` object not present in env environment after calling `data(DT)`
rm(list = c('env'), envir = env)
}