You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Dewey Dunnington (Jira)" <ji...@apache.org> on 2022/03/28 12:35:00 UTC

[jira] [Commented] (ARROW-16038) [R] different behavior from dplyr when mutate's `.keep` option is set

    [ https://issues.apache.org/jira/browse/ARROW-16038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17513345#comment-17513345 ] 

Dewey Dunnington commented on ARROW-16038:
------------------------------------------

Thank you for posting!

Here's where {{.keep}} is implemented: https://github.com/apache/arrow/blob/master/r/R/dplyr-mutate.R#L95-L109

..and a link to the dplyr documentation, since I found that useful to read when thinking about this: https://dplyr.tidyverse.org/reference/mutate.html#arguments

> [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
>            Priority: Minor
>
> 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)