Skip to content
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

fix: Forbid reuse of new columns created in summarize() #106

Merged
merged 1 commit into from Mar 7, 2024

Conversation

krlmlr
Copy link
Collaborator

@krlmlr krlmlr commented Mar 7, 2024

Closes #72.

With this PR:

options(conflicts.policy = list(warn = FALSE))
library(duckplyr)

Sys.setenv(DUCKPLYR_FORCE = TRUE)

data <- tibble(a = c(1L, 1:2), b = 1:3, c = 4:6)
data
#> # A tibble: 3 × 3
#>       a     b     c
#>   <int> <int> <int>
#> 1     1     1     4
#> 2     1     2     5
#> 3     2     3     6

data |>
  as_duckplyr_df() |>
  summarize(
    .by = a,
    b = sum(b),
    c = sum(b * c),
  )
#> Error in `FUN()`:
#> ! Can't reuse summary variable `b`.

Created on 2024-03-07 with reprex v2.1.0

@krlmlr krlmlr merged commit 7ffde64 into main Mar 7, 2024
9 checks passed
@krlmlr krlmlr deleted the b-72-summarize-reuse branch March 7, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent reuse of result in summarize()
1 participant