Skip to content

Key value lost when subsetting with non-existing key value and deselecting columns #3245

Description

@renkun-ken

The latest dev seems to introduce a bug where key value is lost in following subsetting operation:

library(data.table)

dt <- data.table(
  symbol = rep(c("A", "B", "C"), each = 2), 
  group = rep(1:3, each = 2), 
  x = rnorm(6), 
  key = "symbol")
dt["A"]
#>    symbol group           x
#> 1:      A     1  0.01317652
#> 2:      A     1 -0.42823586
dt["A", -"group"]
#>    symbol           x
#> 1:      A  0.01317652
#> 2:      A -0.42823586
dt["D"]
#>    symbol group  x
#> 1:      D    NA NA
dt["D", -"group"]
#>    symbol  x
#> 1:   <NA> NA

Activity

  1. added this to the 1.12.0 milestone on Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions