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

reframe with across returns an unhelpful error message #7657

Open
const-ae opened this issue Feb 12, 2025 · 0 comments
Open

reframe with across returns an unhelpful error message #7657

const-ae opened this issue Feb 12, 2025 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@const-ae
Copy link

When I call reframe with across and the length of the output is not consistent, the error message is a lot less helpful if the output of across is not named:

library(tidyverse)
tibble(x = 1:3, y = 4:6) |>
  reframe(test = across(everything(), \(x){
    rep(letters[x], each = x)
  }))
#> Error in `reframe()`:
#> ℹ In argument: `test = across(...)`.
#> Caused by error in `across()`:
#> ! Can't recycle `..1` (size 3) to match `..2` (size 12).

tibble(x = 1:3, y = 4:6) |>
  reframe(across(everything(), \(x){
    rep(letters[x], each = x)
  }))
#> Error in names(dots)[[i]]: subscript out of bounds

Created on 2025-02-12 with reprex v2.1.1

The situation is slightly better with mutate:

library(tidyverse)
tibble(x = 1:3, y = 4:6) |>
  mutate(test = across(everything(), \(x){
    rep(letters[x], each = x)
  }))
#> Error in `mutate()`:
#> ℹ In argument: `test = across(...)`.
#> Caused by error in `across()`:
#> ! Can't recycle `..1` (size 3) to match `..2` (size 12).

tibble(x = 1:3, y = 4:6) |>
  mutate(across(everything(), \(x){
    rep(letters[x], each = x)
  }))
#> Error in `mutate()`:
#> ℹ In argument: `across(...)`.
#> Caused by error in `across()`:
#> ! Can't compute column `y`.
#> Caused by error in `dplyr_internal_error()`:

Created on 2025-02-12 with reprex v2.1.1

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.1 (2024-06-14)
#>  os       macOS Sonoma 14.6
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/London
#>  date     2025-02-12
#>  pandoc   3.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  ! package     * version date (UTC) lib source
#>  P cli           3.6.3   2024-06-21 [?] CRAN (R 4.4.0)
#>  P colorspace    2.1-1   2024-07-26 [?] CRAN (R 4.4.0)
#>  P digest        0.6.37  2024-08-19 [?] CRAN (R 4.4.1)
#>  P dplyr       * 1.1.4   2023-11-17 [?] CRAN (R 4.4.0)
#>  P evaluate      1.0.3   2025-01-10 [?] CRAN (R 4.4.1)
#>  P fansi         1.0.6   2023-12-08 [?] CRAN (R 4.4.0)
#>  P fastmap       1.2.0   2024-05-15 [?] CRAN (R 4.4.0)
#>  P forcats     * 1.0.0   2023-01-29 [?] CRAN (R 4.4.0)
#>  P fs            1.6.5   2024-10-30 [?] CRAN (R 4.4.1)
#>  P generics      0.1.3   2022-07-05 [?] CRAN (R 4.4.0)
#>  P ggplot2     * 3.5.1   2024-04-23 [?] CRAN (R 4.4.0)
#>  P glue          1.8.0   2024-09-30 [?] CRAN (R 4.4.1)
#>  P gtable        0.3.6   2024-10-25 [?] CRAN (R 4.4.1)
#>  P hms           1.1.3   2023-03-21 [?] CRAN (R 4.4.0)
#>  P htmltools     0.5.8.1 2024-04-04 [?] CRAN (R 4.4.0)
#>  P knitr         1.49    2024-11-08 [?] CRAN (R 4.4.1)
#>  P lifecycle     1.0.4   2023-11-07 [?] CRAN (R 4.4.0)
#>  P lubridate   * 1.9.3   2023-09-27 [?] CRAN (R 4.4.0)
#>  P magrittr      2.0.3   2022-03-30 [?] CRAN (R 4.4.0)
#>  P munsell       0.5.1   2024-04-01 [?] CRAN (R 4.4.0)
#>  P pillar        1.9.0   2023-03-22 [?] CRAN (R 4.4.0)
#>  P pkgconfig     2.0.3   2019-09-22 [?] CRAN (R 4.4.0)
#>  P purrr       * 1.0.2   2023-08-10 [?] CRAN (R 4.4.0)
#>  P R6            2.5.1   2021-08-19 [?] CRAN (R 4.4.0)
#>  P readr       * 2.1.5   2024-01-10 [?] CRAN (R 4.4.0)
#>  P reprex        2.1.1   2024-07-06 [?] CRAN (R 4.4.0)
#>  P rlang         1.1.4   2024-06-04 [?] CRAN (R 4.4.0)
#>  P rmarkdown     2.29    2024-11-04 [?] CRAN (R 4.4.1)
#>  P rstudioapi    0.17.1  2024-10-22 [?] CRAN (R 4.4.1)
#>  P scales        1.3.0   2023-11-28 [?] CRAN (R 4.4.0)
#>  P sessioninfo   1.2.2   2021-12-06 [?] CRAN (R 4.4.0)
#>  P stringi       1.8.4   2024-05-06 [?] CRAN (R 4.4.0)
#>  P stringr     * 1.5.1   2023-11-14 [?] CRAN (R 4.4.0)
#>  P tibble      * 3.2.1   2023-03-20 [?] CRAN (R 4.4.0)
#>  P tidyr       * 1.3.1   2024-01-24 [?] CRAN (R 4.4.0)
#>  P tidyselect    1.2.1   2024-03-11 [?] CRAN (R 4.4.0)
#>  P tidyverse   * 2.0.0   2023-02-22 [?] CRAN (R 4.4.0)
#>  P timechange    0.3.0   2024-01-18 [?] CRAN (R 4.4.0)
#>  P tzdb          0.4.0   2023-05-12 [?] CRAN (R 4.4.0)
#>  P utf8          1.2.4   2023-10-22 [?] CRAN (R 4.4.0)
#>  P vctrs         0.6.5   2023-12-01 [?] CRAN (R 4.4.0)
#>  P withr         3.0.2   2024-10-28 [?] CRAN (R 4.4.1)
#>  P xfun          0.50    2025-01-07 [?] CRAN (R 4.4.1)
#>  P yaml          2.3.10  2024-07-26 [?] CRAN (R 4.4.0)
#> 
#>  [1] /Users/ahlmanne/Documents/Work_Projects/precancer-atlas-code/renv/library/macos/R-4.4/aarch64-apple-darwin20
#>  [2] /Users/ahlmanne/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.4/aarch64-apple-darwin20/f7156815
#>  [3] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#> 
#>  P ── Loaded and on-disk path mismatch.
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@DavisVaughan DavisVaughan added the bug an unexpected problem or unintended behavior label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants