Skip to content

mutate(x = across(c(a, b)) should error #761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mgirlich opened this issue Jan 19, 2022 · 0 comments · Fixed by #958
Closed

mutate(x = across(c(a, b)) should error #761

mgirlich opened this issue Jan 19, 2022 · 0 comments · Fixed by #958
Labels
feature a feature request or enhancement func trans 🌍 Translation of individual functions to SQL

Comments

@mgirlich
Copy link
Collaborator

mgirlich commented Jan 19, 2022

In dplyr a nested tibble is created which is not possible in dbplyr, so this should error

library(dplyr, warn.conflicts = FALSE)
suppressMessages(devtools::load_all("~/GitHub/dbplyr/"))


tibble(a = 1, b = 2) %>% 
  mutate(a = 2, x = across())
#> # A tibble: 1 × 3
#>       a     b   x$a    $b
#>   <dbl> <dbl> <dbl> <dbl>
#> 1     2     2     2     2

lazy_frame(a = 1, b = 2) %>% 
  mutate(a = 2, x = across())
#> <SQL>
#> SELECT `a`, `b`
#> FROM (
#>   SELECT 2.0 AS `a`, `b`
#>   FROM `df`
#> ) `q01`

Created on 2022-01-19 by the reprex package (v2.0.1)

TEST

test_that("mutate() error if gets multiple columns in across()", {
  df <- lazy_frame(a = 1, b = 2)
  expect_snapshot({
    (expect_error(mutate(df, a = 2, x = across())))
  })
})
@hadley hadley added feature a feature request or enhancement func trans 🌍 Translation of individual functions to SQL labels Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement func trans 🌍 Translation of individual functions to SQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants