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

pass dots from as_factor.data.frame to as_factor.haven_labelled #407

Merged
merged 4 commits into from Jan 28, 2019

Conversation

zkamvar
Copy link
Contributor

@zkamvar zkamvar commented Sep 26, 2018

Arguments to the haven_labelled class were not being passed from the as_factor.data.frame() method and were being silently ignored:

library("haven")
x <- labelled(sample(5, 10, replace = TRUE), c(Bad = 1, Good = 5))
y <- data.frame(list(x = x))
as_factor(x, levels = "values")
#>  [1] <NA> 1    5    5    <NA> 1    1    <NA> 1    5   
#> Levels: 1 5
as_factor(y, levels = "values")$x # should be the same as above
#>  [1] 4    Bad  Good Good 4    Bad  Bad  3    Bad  Good
#> Levels: Bad 3 4 Good

Created on 2018-09-26 by the reprex package (v0.2.0).

This PR should fix that

Arguments to the haven_labelled class were not being passed from the
as_factor.data.frame method. This hopefully fixes it
@hadley
Copy link
Member

hadley commented Jan 23, 2019

Would you mind including a unit test?

Can you please add a bullet to NEWS? It should briefly describe the change and end with (@yourname, #issuenumber).

@hadley hadley merged commit 65432e8 into tidyverse:master Jan 28, 2019
0 of 2 checks passed
@hadley
Copy link
Member

hadley commented Jan 28, 2019

Thanks! I finished it off.

@lock
Copy link

lock bot commented Jul 27, 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 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants