Skip to content

write_dta: numeric labelleds not written correctly #144

Closed

Description

I caught this in #140 but have not yet discovered the cause of the problem.

> num <- labelled(c(1, 2), c(a = 1, b = 3))
> num
<Labelled>
[1] 1 2

Labels:
 value label is_na
     1     a FALSE
     3     b FALSE
> roundtrip_var(num)
<Labelled>
[1] 1 2

Labels:
 value label is_na
     0     a FALSE
     0     b FALSE

I opened the file in Stata and verified that the labels are not written correctly:

. label list
x..i..:
           0 a
           0 b

It might be a bug in ReadStat, since the label-writing code in DfWriter seems to be basically the same as the code for integer labelleds, which do work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions