Skip to content

DT[TBL, a:=i.b] update join with 'i.' prefix fails when 'i' is a tibble #6998

@MichaelChirico

Description

@MichaelChirico
library(data.table)
library(tibble)

DT1 = data.table(a=1, b=2)
DT2 = data.table(a=1, c=3)
DF = data.frame(a=1, d=4)
TBL = tibble(a=1, e=5)

# fine
DT1[DT2, on='a', c := i.c]

# also fine
DT1[DF, on='a', d := i.d]

# error
DT1[TBL, on='a', e := i.e]
# Error in eval(jsub, SDenv, parent.frame()) : object 'i.e' not found

DT1
#        a     b     c     d
#    <num> <num> <num> <num>
# 1:     1     2     3     4

This is inconsistent -- either we should require i to be a data.table (so DT1[DF, ...] would fail), or we should treat all is.data.frame(i) && !is.data.table(i) cases the same.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions