[R] Possible bug in foreign library import of Stata datasets

Thomas Lumley tlumley at u.washington.edu
Wed Apr 28 17:24:53 CEST 2004


On Wed, 28 Apr 2004, Peter Dalgaard wrote:
>
> Looks like a classic signed/unsigned confusion. Negative numbers
> stored in ones-complement format in single bytes, but getting
> interpreted as unsigned. A bug report could be a good idea if the
> resident Stata expert (Thomas, I believe) is unavailable just now.
>

Yes, it's a simple signed/unsigned bug. We carefully read in the 2-byte
and 4-byte types as unsigned int so we can use << and >> to do byte
swapping, but of course this doesn't work for the 1-byte type.  There's
the additional problem that sometimes we want to read an unsigned byte of
meta-data.

	-thomas




More information about the R-help mailing list