Skip to content

vctrs internal error caused by apparent collapse package bug #1969

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
kendonB opened this issue Apr 23, 2025 · 1 comment
Closed

vctrs internal error caused by apparent collapse package bug #1969

kendonB opened this issue Apr 23, 2025 · 1 comment

Comments

@kendonB
Copy link

kendonB commented Apr 23, 2025

library(tidyverse)
library(collapse)
no_rows_tibble <- tibble::tibble(var_1 = character(), var_2 = numeric())
tmp <- no_rows_tibble |>
  collapse::fgroup_by(var_1) |>
  collapse::fsummarise(var_2 = sum(var_2))
bind_rows(tmp, tmp)
#> Error in `vec_rbind()`:
#> ! Unexpected `NULL`.
#> ℹ In file 'slice.c' at line 322.
#> ℹ This is an internal error that was detected in the vctrs package.
#>   Please report it at <https://github.com/r-lib/vctrs/issues> with a reprex (<https://tidyverse.org/help/>) and the full backtrace.

Created on 2025-04-23 with reprex v2.1.1

@DavisVaughan
Copy link
Member

Thanks, this looks like a collapse bug to me. The generated NULL column is invalid as part of a data frame.

library(tidyverse)
library(collapse)

no_rows_tibble <- tibble::tibble(var_1 = character(), var_2 = numeric())
tmp <- no_rows_tibble |>
  collapse::fgroup_by(var_1) |>
  collapse::fsummarise(var_2 = sum(var_2))

# Looks like a collapse bug. `var_2` should be `numeric()` not `NULL`.
# This is an invalid data frame.
unclass(tmp)
#> $var_1
#> character(0)
#> 
#> $var_2
#> NULL
#> 
#> attr(,"row.names")
#> integer(0)

Created on 2025-04-23 with reprex v2.1.1

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

No branches or pull requests

2 participants