8000 [R-Forge #5688] Column subset on DTs with duplicate names by index still returns first dup column · Issue #22 · Rdatatable/data.table · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[R-Forge #5688] Column subset on DTs with duplicate names by index still returns first dup column #22

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

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@arunsrinivasan
Copy link
Member

Submitted by: Arun ; Assigned to: Arun ; R-Forge link

Best with an example:

require(data.table) ## 1.9.3
DT <- data.table(x=1:5, x=6:10)
DT[, 1:2, with=FALSE]

It's clear that the columns to choose are 1st and 2nd. Still, it gives back just the first column:

   x x
1: 1 1
2: 2 2
3: 3 3
4: 4 4
5: 5 5

data.frame does this very nicely, although it renames the columns (which we don't have to do).

as.data.frame(DT)[, 1:2]
  x x.1
1 1   6
2 2   7
3 3   8
4 4   9
5 5  10
@arunsrinivasan
Copy link
Member Author

Also updated this SO post and here's the commit that fixed handling duplicate names: 9f0a7f8

@arunsrinivasan arunsrinivasan added this to the v1.9.4 milestone Jun 19, 2014
@arunsrinivasan arunsrinivasan self-assigned this Jun 20, 2014
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

1 participant
0