Skip to content

[R-Forge #2607] Filtering by logical column, combined with deleting that column doesn't perform the filter #506

@arunsrinivasan

Description

@arunsrinivasan

Submitted by: Matt Dowle; Assigned to: Nobody; R-Forge link

require(data.table)
DT = data.table(a=1:9, grp=1:3)

DT[ , keep := c(rep(FALSE, .N-1), TRUE), by = grp]
DT[(keep), keep := NULL][] # ignores keep

DT[, keep := c(rep(FALSE, .N-1), TRUE), by = grp]
DT[keep==TRUE, keep := NULL][] # ignores keep

DT[, keep := c(rep(FALSE, .N-1), TRUE), by = grp]
DT[(keep)][, keep := NULL][] # works

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions