Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-16038

[R] different behavior from dplyr when mutate's `.keep` option is set

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 7.0.0
    • 8.0.0
    • R

    Description

      The order of columns when `dplyr::mutate`'s `.keep` option is set to "none", etc. has been changed in dplyr 1.0.8 and differs from the current behavior of the arrow package.

      For more information, please see the following issues.

      https://github.com/tidyverse/dplyr/pull/6035
      https://github.com/tidyverse/dplyr/issues/6086
      https://github.com/tidyverse/dplyr/pull/6087

      library(dplyr, warn.conflicts = FALSE)
      
      df <- tibble::tibble(x = 1:3, y = 4:6)
      
      df |>
        transmute(x, z = x + 1, y)
      #> # A tibble: 3 × 3
      #>       x     z     y
      #>   <int> <dbl> <int>
      #> 1     1     2     4
      #> 2     2     3     5
      #> 3     3     4     6
      
      df |>
        mutate(x, z = x + 1, y, .keep = "none")
      #> # A tibble: 3 × 3
      #>       x     y     z
      #>   <int> <int> <dbl>
      #> 1     1     4     2
      #> 2     2     5     3
      #> 3     3     6     4
      
      df |>
        arrow::arrow_table() |>
        mutate(x, z = x + 1, y, .keep = "none") |>
        collect()
      #> # A tibble: 3 × 3
      #>       x     z     y
      #>   <int> <dbl> <int>
      #> 1     1     2     4
      #> 2     2     3     5
      #> 3     3     4     6
      

      Attachments

        Issue Links

          Activity

            People

              boshek Sam Albers
              eitsupi SHIMA Tatsuya
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m