tidyverts / tsibble

Tidy Temporal Data Frames and Tools
https://tsibble.tidyverts.org
GNU General Public License v3.0
531 stars 49 forks source link

index_by column name duplication error in dev version #181

Closed davidtedfordholt closed 4 years ago

davidtedfordholt commented 4 years ago

Unsure if this is a function of an issue already open. The following example (and other examples for index_by() current fail when using dplyr 0.8.99.9002 and tsibble 0.8.9.9000.

tourism %>%
  index_by(Year = lubridate::year(Quarter)) %>%
  group_by(Region, State) %>%
  summarise(Total = sum(Trips))

#> Error: Column name `Year` must not be duplicated.
#> Run `rlang::last_error()` to see where the error occurred.
#> In addition: Warning message:
#> The `add` argument of `group_by()` is deprecated as of dplyr 1.0.0.
#> Please use the `.add` argument instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated. 

rlang::last_error()

#> <error/tibble_error_column_names_must_be_unique>
#> Column name `Year` must not be duplicated.
#> Backtrace:
#>   1. tsibble::index_by(., Year = lubridate::year(Quarter))
#>   1. dplyr::group_by(., Region, State)
#>   9. dplyr::summarise(., Total = sum(Trips))
#>  15. tsibble:::index_by.tbl_ts(.data, !!idx2)
#>  17. dplyr:::group_by.data.frame(...)
#>  18. dplyr::grouped_df(groups$data, groups$group_names, .drop)
#>  19. dplyr:::compute_groups(data, vars, drop = drop)
#>  20. tibble::tibble(!!!old_keys, `:=`(".rows", old_rows))
#>  21. tibble:::tibble_quos(xs[!is_null], .rows, .name_repair)
#>  22. tibble:::set_repaired_names(output, .name_repair = .name_repair)
#>  24. tibble:::repaired_names(...)
#>  25. tibble:::subclass_name_repair_errors(...)
#>  26. base::tryCatch(...)
#>  27. base:::tryCatchList(expr, classes, parentenv, handlers)
#>  28. base:::tryCatchOne(...)
#>  29. value[[3L]](cond)
#> Run `rlang::last_trace()` to see the full context.