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

keyby with multiple keys with same name do not respect ordering of factors #1334

Closed
caneff opened this issue Sep 16, 2015 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@caneff
Copy link

caneff commented Sep 16, 2015

This is a very edge case with an easy workaround but I ran into it using cut on multiple variables in a key.

d <- data.table(x=ordered(rep(1:3,each=5)),y=ordered(rep(c("B","A","C"),5),levels=c("B","A","C")),z=1:15)
d[, mean(z), keyby=.(x,y)] # Ordering is respected
d[, mean(z), keyby=.(I(x), I(y))] # Ordering of the y column is not respected
d[, mean(z), keyby=.(a=I(x), b=I(y))] # Ordering of the y column respected again now that the column names are different.
@arunsrinivasan arunsrinivasan added this to the v1.9.8 milestone Sep 27, 2015
@arunsrinivasan arunsrinivasan self-assigned this Sep 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants