user8401743
user8401743

Reputation: 100

Writing R data.table object to hdf5 file

I have R data.table which I tried to write as h5 file using rhdf5 package. This gives me a warning h5writeAttribute.default(Attr[[i]], h5obj, name = names(Attr)[i]) : No function found to write attribute of class 'externalptr'. Attribute '.internal.selfref' is not written to hdf5-file. When I read the file, I see that many columns are not there. Specifically, columns of type list() are missing. I get same results whether I use write.attributes=TRUE or write.attributes=FALSE in h5write function. Any suggestions? Reproducible Example:

library(rhdf5)
library(data.table)

tmp <- data.table(character = "Name", 
              logical = "FALSE",
              list = list(tmp = c("a", "b")),
              logical2 = "TRUE"
)
h5write(tmp, "tmp.h5", "test",write.attributes=TRUE)
h5closeAll()
tmpRead = h5read(file="tmp.h5","test")
h5closeAll()

tmp
character logical list logical2
1   Name    FALSE   c("a", "b") TRUE

tmpRead
character logical logical2
1   Name    FALSE   TRUE

Upvotes: 1

Views: 814

Answers (0)

Related Questions