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

Closed
JanMarvin opened this issue Nov 10, 2018 · 2 comments

Comments

@JanMarvin
Copy link

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).

library(haven)

fl <- tempfile()
url <- "http://janda.org/c10/data%20sets/World/world-95.por"
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

haven_bug

@evanmiller

This comment has been minimized.

Copy link
Contributor

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.

@lock

This comment has been minimized.

Copy link

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. https://reprex.tidyverse.org/

@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.
Projects
None yet
2 participants
You can’t perform that action at this time.