Skip to content

Left join columns order changed #139

Description

@engineerchange

Thank you for all the work put into dtplyr; it already is saving me loads of time in my day to day.

It appears that left_join causes columns to change order. Doesn't appear to be an issue with right_join or merge.

library(data.table)
library(dtplyr)
library(dplyr,warn.conflicts=FALSE)

packageVersion("data.table")
#> [1] '1.12.8'
packageVersion("dtplyr")
#> [1] '1.0.0.9000'

x1 <- data.frame(x = 1:3, y = 1)
x2 <- data.frame(x = 1:3, z = 2)

x1 %>%
  left_join(x2, by="x")
#>   x y z
#> 1 1 1 2
#> 2 2 1 2
#> 3 3 1 2

x1 %>%
  lazy_dt() %>%
  left_join(x2, by="x") %>%
  as_tibble()
#> # A tibble: 3 x 3
#>       x     z     y
#>   <int> <dbl> <dbl>
#> 1     1     2     1
#> 2     2     2     1
#> 3     3     2     1

Created on 2019-12-29 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions