I want to save and load my data.tables using saveRDS
. What I do is the following:
dt <- data.table(1:3)
# saving to disk:
saveRDS(dt,"ThisIsMyDT")
# reloading in a different session:
dt <- readRDS("ThisIsMyDT")
# and since the pointer does not exist:
attr(dt,".internal.selfref")
alloc.col(dt)
Is there a better way of doing this? Somehow I've got the suspicion that I could/should use the refhook argument in the saveRDS
and readRDS
functions. However, I can't really figure out how I'd do that...