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

complete() turns ordered factors into unordered factors #165

Closed
phirsch opened this issue Feb 15, 2016 · 0 comments
Closed

complete() turns ordered factors into unordered factors #165

phirsch opened this issue Feb 15, 2016 · 0 comments

Comments

@phirsch
Copy link

@phirsch phirsch commented Feb 15, 2016

If complete() is applied to a column that is an ordered factor, the result is no longer an ordered factor, but a plain factor instead (in tidyr_0.4.1):

> df = data_frame(a = as.ordered(1:2), b = as.ordered(1:2))
> str(df)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   2 obs. of  2 variables:
 $ a: Ord.factor w/ 2 levels "1"<"2": 1 2
 $ b: Ord.factor w/ 2 levels "1"<"2": 1 2
> df %>% complete(a, b) %>% str()
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   4 obs. of  2 variables:
 $ a: Factor w/ 2 levels "1","2": 1 1 2 2
 $ b: Factor w/ 2 levels "1","2": 1 2 1 2
> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant