-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
Thanks for making this nice tool firstly. I got an error when I tried to rewrite code with dtplyr. I debugged the code and found the left_join() returns the result of right join and vice versa.
library(dplyr, warn.conflicts = FALSE)
library(data.table)
library(dtplyr)
a <- lazy_dt(data.table(x_left = 1:3, y = 1))
b <- lazy_dt(data.table(x_right = 2:4, z = 2))
left_join(a, b, by=c("x_left"="x_right"))
Join result
> left_join(a, b, by=c("x_left"="x_right"))
Source: local data table [?? x 4]
Call: `_DT2`[`_DT1`, on = .(x_right = x_left), allow.cartesian = TRUE]
x_right z y
<int> <dbl> <dbl>
1 1 NA 1
2 2 2 1
3 3 2 1
# Use as.data.table()/as.data.frame()/as_tibble() to access results
> left_join(as_tibble(a), as_tibble(b), by=c("x_left"="x_right"))
# A tibble: 3 x 3
x_left y z
<int> <dbl> <dbl>
1 1 1 NA
2 2 1 2
3 3 1 2
engineerchange
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior