grimbough / rhdf5

Package providing an interface between HDF5 and R
http://bioconductor.org/packages/rhdf5
60 stars 21 forks source link

Write string attributes as a string #79

Closed LTLA closed 3 years ago

LTLA commented 3 years ago

When using h5writeAttributes, it seems that we end up with arrays of fixed-width strings (probably H5T_C_S1?). This confuses other HDF5 readers that expect an actual string (usually one of the H5T_CSET options).

It seems like it would be generally useful to include an encoding= option in h5writeAttributes that allows us to switch to ASCII or UTF-8 when a length-1 character vector is supplied. A similar option might also be useful for h5writeDataset as well. For all other character vectors, this argument can be ignored, with a warning, or we can error out and say that they can't do that.

TriLe965 commented 3 years ago

Is this issue resolved? I'm trying to write an actual string with h5writeAttributes but it seems impossible.

grimbough commented 3 years ago

Thanks for the pull request @LTLA That's now been merged and should be available in version 2.35.4