SHIMA Tatsuya created ARROW-16038:
-------------------------------------

             Summary: [R] different behavior from dplyr when mutate's `.keep` 
option is set
                 Key: ARROW-16038
                 URL: https://issues.apache.org/jira/browse/ARROW-16038
             Project: Apache Arrow
          Issue Type: Improvement
          Components: R
    Affects Versions: 7.0.0
            Reporter: SHIMA Tatsuya


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

{code:r}
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
{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to