Skip to content

Respect nomatch = 0L for integer i #3109

@mllg

Description

@mllg

Currently nomatch seems to be ignored if i in dt[i, j, nomatch = 0L] is integer. Values of i which are out of bounds or NA result in rows filled with NA:

dt = data.table(x = 1:10)
dt[c(1L, 11L, NA_integer_), x, nomatch = 0L]
> 1 NA NA

I see no reason to not support nomatch = 0L for integer i.

Also note that the current handling of negative integer i seems to be inconsistent with not-joins:

# mixing negation/not-join with nomatch
dt[-1L, nomatch = 0L] # works, nomatch ignored
dt[!list(1L), on = "x", nomatch = 0L] # exception

# negation/not-join with out-of-bounds values
dt[-11L] # warning
dt[!list(11), on = "x"] # no warning

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions