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

Default colorder with setcolorder based off keys and indices #2895

Closed
jsams opened this issue May 21, 2018 · 4 comments
Closed

Default colorder with setcolorder based off keys and indices #2895

jsams opened this issue May 21, 2018 · 4 comments
Milestone

Comments

@jsams
Copy link
Contributor

jsams commented May 21, 2018

I'm proposing to have setcolorder(x) set the columns in the order specified by the keys, then remaining index columns, then the rest of the columns. I have a fork with the change already. Not sure if it would be welcome though. It makes for a nice mindless but sensible ordering to the data.

DT = data.table(a = 1:3, b = 2:4, c = 3:5)
setkey(DT, c)
setindex(DT, b)
all.equal(names(setcolorder(DT)),  c("c", "b", "a"))

Forked branch available here master...jsams:colorder_keys

Happy to make a PR if this is something that would be welcome (and sorry for the tracker spam the past few hours). Tried setting up the tests and such, but really, I have no idea what's going on with the testing framework here to be honest.

@jangorecki
Copy link
Member

jangorecki commented May 22, 2018

What about multiple multi-column indices? there are no tests covering that.
If you are asking how to use test function in tests.Rraw it looks like you use it correctly. If you are asking about setting up test in general then use the standard R way, R CMD build . followed by R CMD check data.table_1.11.3.tar.gz.

@MichaelChirico
Copy link
Member

Be sure also to read the Contributing page, which has some details about how to use test, let us know if there's some unclear points still (and, it being a wiki, feel free to edit if there's anything unclear)

@jsams
Copy link
Contributor Author

jsams commented May 22, 2018

Thanks for the pointers! Figured out how to run the tests. More tests added, a bug uncovered/fixed, and news item added. LMK if you think this is worthy of a PR and i'll make it.

@MichaelChirico
Copy link
Member

I don't see any harm in filing a PR, especially since it seems yours is ready. Certainly the surest way to move the conversation along. 👍 thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants