tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

unpack_hilo() not working with tidyr v1.3.0 #376

Closed robjhyndman closed 1 year ago

robjhyndman commented 1 year ago
library(fable)
#> Loading required package: fabletools
library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, union

as_tsibble(Nile) %>%
  model(NAIVE(value)) %>%
  forecast() |> 
  hilo(level = 95) |> 
  unpack_hilo(`95%`)
#> Error in `tidyr::unpack()`:
#> ! Can't rename variables in this context.

#> Backtrace:
#>      ▆
#>   1. └─fabletools::unpack_hilo(...)
#>   2.   └─tidyr::unpack(data, cols, names_sep = names_sep, names_repair = names_repair)
#>   3.     └─tidyselect::eval_select(...)
#>   4.       └─tidyselect:::eval_select_impl(...)
#>   5.         ├─tidyselect:::with_subscript_errors(...)
#>   6.         │ └─rlang::try_fetch(...)
#>   7.         │   └─base::withCallingHandlers(...)
#>   8.         └─tidyselect:::vars_select_eval(...)
#>   9.           └─tidyselect:::ensure_named(...)
#>  10.             └─cli::cli_abort(...)
#>  11.               └─rlang::abort(...)

Created on 2023-01-30 with reprex v2.0.2

mitchelloharawild commented 1 year ago

Fixed in dd9027da9c21d99b9f2c8dbb662d7ae465933e68. It seems renaming columns selected by column number is no longer allowed? This may be an unintended tidyr reversion.

This function is also superceded by {distributional} functionality, and will be considered for deprecation in an upcoming release.