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

setcolorder works like setnames #860

Closed
wants to merge 2 commits into from
Closed

setcolorder works like setnames #860

wants to merge 2 commits into from

Conversation

matthieugomez
Copy link
Contributor

This solves #798 and #592 in a way consistent with how setnames works.
When only one argument is given (beyond the data.table) , setcolorder behavior does the exact same thing as before. However, I renamed this argument from "neworder" to "old" to be consistent with setnames.

A second argument (a numeric vector) can now be specified.

dt <- data.table(id = c(1,2), date = c(1999, 2000))
setcolorder(dt, "date", 1)
setcolorder(dt, 2, 1)
setcolorder(dt, "id", 2)
setcolorder(dt, 1, 2)

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

Successfully merging this pull request may close these issues.

1 participant