Hey all, Simple question that I've been stuck on. I'm preallocating my dataset such that I can load them up iteratively as I process new data. What I've not been able to sort is how to define coulmn names after the dataset is created. It appears possible when you feed in a dataframe, but not a matrix.
# create a dataset using h5df
h5createDataset(file = 'proj.h5',
dataset ='instrumen1/Metrics2',
dims = c(500, 2000),
chunk = c(50, 2000),
storage.mode = "double",
fillValue= NaN)
# Once next batch of data are processed (newData) write it to the block
newData = matrix(0, 3,2000)
dataStart = 1
columnNames = as.character(10:2010)
# Write new data to existing database
h5write(
newData,
file = 'proj.h5',
dataset ='instrumen1/Metrics2',
start = c(dataStart, 1),
count = c(nrow(newData), ncol(newData)),
#write.options = list(colnames = TRUE) - this doesn't work
)
sessionInfo( )
I've been able to get it to work using the h5dfr package as an attribute so perhaps column names are using the h5writeAttribute? I haven't been able to sort the syntax.. Thanks again!
Thanks Mike!