grimbough / rhdf5

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

rhdf5 NA's in int32 #10

Open grimbough opened 6 years ago

grimbough commented 6 years ago

Hello, I believe I noticed two bugs in rhdf5.

I'm using R 3.3.3 on Windows64, 2.18.0 linking to C-library HDF5 1.8.7

  1. problem:

h5read(..., bit64conversion='double')

converts int32 columns to double as well. I did not expect that the option would affect 64bit integer types only. Is this intentional? Is it documented?

  1. problem:

AFAIK -2^63 of type int64 is not a number, it encodes NA. I would expect that even with bit64conversion='double' or 'int', this special value silently becomes NA. (Or am I wrong? Is this convention generally accepted?)

The warnings "integer precision lost" or "integer overflow" (respectively), that are triggered by values that are in abs >= 2^53 or >= 2^31 (resp.), should not be triggered by this special value.

Thank you all for the package, Stepan Kasal

grimbough commented 6 years ago

Problem 1 should be addressed in #24 HDF5 datasets with integer datatype smaller than 32-bit or signed 32-bit are now read directly by h5read() regardless of whether any conversion is specified.