Skip to content

setDT should be more careful on altering its input #2683

Description

@jangorecki

setDT remove names attribute from input vector, that should not happen.

x = c(a = 4, b = 5)
setDT(list(c = x))[]
names(x) 

Related
#4240
#2487
#1916
#1244
#683

Activity

  1. added this to the milestone on Mar 16, 2018
  2. changed the title [-]setDT should be more careful on altering it's input[/-] [+]setDT should be more careful on altering its input[/+] on Mar 17, 2018
  3. modified the milestones: v1.11.0, on Apr 29, 2018
  4. BenoitLondon commented on Sep 5, 2018

    @BenoitLondon

    A related bug:

    setDT even modifies the input vector if the data.table is modified later on

    see here

    a <- 1:2 / 2
    x <- 1:10 / 2
    y <- 11/2
    dt <- data.frame(a, x, y)
    setDT(dt)
    dt[ , cond := a == 1]
    dt[(cond), c("x", "y") := list(y, x)]
    x
    #[1] 0.5 5.5 1.5 5.5 2.5 5.5 3.5 5.5 4.5 5.5
  5. modified the milestones: 1.12.0, 1.12.2 on Jan 11, 2019
  6. modified the milestones: 1.12.2, 1.12.4 on Jan 24, 2019
  7. arunsrinivasan commented on Feb 16, 2019

    @arunsrinivasan
    Member

    @BenoitLondon your issue is slightly different.. I've answered your SO post.

  8. modified the milestones: 1.12.4, 1.13.0 on Sep 17, 2019
  9. modified the milestones: 1.12.7, 1.12.9 on Dec 8, 2019
  10. modified the milestones: 1.13.1, 1.13.3 on Oct 17, 2020
  11. OfekShilon commented on May 9, 2021

    @OfekShilon
    Contributor

    I believe this (and some other similar bugs) could be solved by this PR: #4978

  12. modified the milestones: 1.14.3, on Jul 19, 2022
  13. modified the milestones: , 1.15.1 on Oct 29, 2023
  14. removed this from the 1.16.0 milestone on Nov 6, 2023
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions