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

get() reorders .SD columns #2036

Closed
TonyBonen opened this issue Feb 20, 2017 · 1 comment
Closed

get() reorders .SD columns #2036

TonyBonen opened this issue Feb 20, 2017 · 1 comment
Labels
Milestone

Comments

@TonyBonen
Copy link

@TonyBonen TonyBonen commented Feb 20, 2017

I came across an issue with .SDcols when using get() in the j argument. I posted about it on SO here.

dt2 = data.table(col1 = rep(LETTERS[1:3], 4),
                           b = rnorm(12),
                           a = 1:12,
                           neg = -1)
d.vars = c('a', 'b')   # used in .SDcols
negate <- 'neg'

When the neg column is called with get() the .SD table columns are ordered as in dt2 rather than according to the order given in the .SDcols = d.vars argument:

   dt2[, {neg; names(.SD)}, .SDcols=d.vars]
   # [1] "a " "b"
   dt2[, {get(negate); names(.SD)}, .SDcols=d.vars]
   # [1] "b" "a"

In the comments Frank suggested it might be related to the mget bug #1744.

 > sessionInfo()
 R version 3.3.2 (2016-10-31)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 Running under: Windows 7 x64 (build 7601) Service Pack 1


 
> packageVersion("data.table")
[1] ‘1.9.8’
@DavidArenburg
Copy link
Member

@DavidArenburg DavidArenburg commented Mar 1, 2017

As a side note, it is better to test bugs on the latest version (just in case they were already fixed).

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.

4 participants
You can’t perform that action at this time.