Skip to content

Wrong behaviour DT[, i, with=FALSE]  #2109

Description

@cguill95

Hi,

I noticed a strange type of behaviour using the with=FALSE parameter in a data table.
Maybe worth mentioning I am using data table version 1.10.4. on R 3.3.2

Here is a reproducible example;

library(data.table)
test <- data.table(mtcars)
i <- 3L

# Print 3rd column
test[, i, with=FALSE]

# Print 4th column
test[, i + 1L, with=FALSE]

# Print all but 3rd column
test[, i - 1L, with=FALSE]

Activity

  1. franknarf1 commented on Apr 10, 2017

    @franknarf1
    Contributor

    Yeah, I guess it parses the expression, sees that - is the top-level function and wings it from there somehow, similar to this bug: #2069 Parentheses stop it: test[, (i - 1L), with=FALSE]

  2. arunsrinivasan commented on Jun 29, 2017

    @arunsrinivasan
    Member

    IIUC this line would need a length(jsub) == 2L extra condition...

  3. self-assigned this
    on Feb 14, 2018
  4. added a commit that references this issue on Aug 18, 2019
    ca41b6b
  5. added this to the 1.12.4 milestone on Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions