join data.tables (multiple options)

PHOTO EMBED

Thu Jun 08 2023 12:49:41 GMT+0000 (Coordinated Universal Time)

Saved by @vs #r

# inner join
merge(dt1, dt2, by = c("col1", "col2"))

# left join
merge(dt1, dt2, by = c("col1", "col2"), all.x = TRUE)

# right join
merge(dt1, dt2, by = c("col1", "col2"), all.y = TRUE)
content_copyCOPY