2

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...

Chris
  • 139
  • 9
  • 2
    Perhaps [this](http://stackoverflow.com/questions/31250999/r-readrds-load-fail-to-give-identical-data-tables-as-the-original) helps – akrun May 14 '16 at 20:47
  • 2
    Some times ago I checked what was fastest way to save and then load dataframes. `save()\load()` uncompressed was fastest, `sqlite ` was close second, but might be fastest depending on circumstances. Link: http://stackoverflow.com/questions/33839880/fastest-way-to-save-load-data-table – Severin Pappadeux May 14 '16 at 22:41

0 Answers0