Skip to content

Automatic indexing and ! operator #932

@arunsrinivasan

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions