Closed
Description
Hello, I stumbled on this by mistake and thought I'd open a PR given the error message.
It seems that unite
could make an assertion about the shape of its input to prevent this.
Brief description of the problem: unite
encounters an internal error if the input data is empty.
library(tibble)
library(tidyr)
options(error = traceback)
tibble(x=NULL) %>% unite(col='tmp', everything())
#> Error in `df_append()`:
#> ! `after` must be a whole number, not an integer `NA`.
#> ℹ This is an internal error that was detected in the tidyr package.
#> Please report it at <https://github.com/tidyverse/tidyr/issues> with a reprex
#> (<https://tidyverse.org/help/>) and the full backtrace.
#> Backtrace:
#> ▆
#> 1. ├─tibble(x = NULL) %>% unite(col = "tmp", everything())
#> 2. ├─tidyr::unite(., col = "tmp", everything())
#> 3. └─tidyr:::unite.data.frame(., col = "tmp", everything())
#> 4. └─tidyr:::df_append(after = after)
#> 5. └─tidyr:::check_number_whole(after, min = 0L, max = n, .internal = TRUE)
#> 6. └─tidyr:::.rlang_types_check_number(...)
#> 7. └─tidyr (local) .stop(x, what, ...)
#> 8. └─tidyr:::stop_input_type(...)
#> 9. └─rlang::abort(message, ..., call = call, arg = arg)
Created on 2024-09-25 with reprex v2.0.2
Metadata
Metadata
Assignees
Labels
No labels