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

across2x() .comb = "minimal" argument not working correctly #21

Open
TimTeaFan opened this issue Jan 24, 2023 · 0 comments
Open

across2x() .comb = "minimal" argument not working correctly #21

TimTeaFan opened this issue Jan 24, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@TimTeaFan
Copy link
Owner

.comb = "minimal" is not working if we use NULL inside .fns.

library(tidyverse)
library(dplyover)

df <- tibble(V1 = sample(c(0,1), 25, replace=TRUE, prob=c(0.6, 0.4)),
             V2 = sample(c(0,1), 25, replace=TRUE, prob=c(0.6, 0.4)),
             V3 = sample(c(0,1), 25, replace=TRUE, prob=c(0.8, 0.2)),
             V4 = sample(c(0,1), 25, replace=TRUE, prob=c(0.7, 0.3)),
             V5 = sample(c(0,1), 25, replace=TRUE, prob=c(0.8, 0.2)),
             V6 = sample(c(0,1), 25, replace=TRUE, prob=c(0.8, 0.2)),
             V7 = sample(c(0,1), 25, replace=TRUE, prob=c(0.8, 0.2)))



df %>% 
  mutate(across2x(everything(),
                  everything(),
                  ~ {
                    check <- .x * .y
                    if (!any(check)) {
                      NULL }
                    else {
                      ifelse(check, 1, 0 )
                      }
                  },
                  .comb = "minimal"
                  )
  )
#> Error in `mutate_cols()`:
#> ! Problem with `mutate()` input `..1`.
#> i `..1 = across2x(...)`.
#> x Attribut 'names' [49] muss dieselbe Länge haben wie der Vektor [42]
#> Caused by error in `names(out) <- names`:
#> ! Attribut 'names' [49] muss dieselbe Länge haben wie der Vektor [42]

Created on 2023-01-24 by the reprex package (v2.0.1)

@TimTeaFan TimTeaFan added the bug Something isn't working label Jan 24, 2023
@TimTeaFan TimTeaFan self-assigned this Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant