Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_por: imports incorrect values #413

JanMarvin opened this issue Nov 10, 2018 · 2 comments

read_por: imports incorrect values #413

JanMarvin opened this issue Nov 10, 2018 · 2 comments


Copy link

@JanMarvin JanMarvin commented Nov 10, 2018

While writing my own spss file reader I came across a bug in haven or ReadStat. See the attached example. The example shows only a single value, there are several others in the file (checked with foreign, spss, pspp and my package as well).


fl <- tempfile()
url <- ""
download.file(url, fl)

df_h <- read_por(fl)

# example there are other differences in this file
df_h$POPULATN[df_h$COUNTRY == "Brazil"] # is 17400 should be 156600


Copy link

@evanmiller evanmiller commented Jan 10, 2019

Welp. It looks like ReadStat was using base-10 for the exponent part instead of base-30. Since the exponent was 2 for this particular value, that explains why the result was off by a factor of 9 (30^2/10^2). The tests weren't catching it because ReadStat is lazy and never emits an exponent, just a long mantissa. I'll get this fixed ASAP.

Copy link

@lock lock bot commented Jul 22, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue.

@lock lock bot locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants