Skip to content

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

Closed

Description

@arunsrinivasan

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

Activity

  1. arunsrinivasan commented on Jun 19, 2014

    @arunsrinivasan
    MemberAuthor

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

  2. added this to the v1.9.4 milestone on Jun 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions