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

Comments

Projects
None yet
1 participant
@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
> 

@hadley hadley closed this in fd505e0 May 16, 2016

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