Skip to content

Automatic indexing and ! operator #932

Closed

Description

@arunsrinivasan

Thanks to Matthieu for the email.

require(data.table)
DT <- data.table(v1 = c(1,NA,2), v2 = c(1,NA,2))

DT[!(v1==1)]
#    v1 v2
#1:  2  2
DT[!v1==1] ## different result due to auto indexing
#    v1 v2
#1: NA NA
#2:  2  2
options(datatable.auto.index=FALSE)
DT[!v1==1] ## turning off restores default functionality
#    v1 v2
#1:  2  2
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