tidyverts / tsibble

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

Fixes #194 #223

Closed TylerGrantSmith closed 3 years ago

TylerGrantSmith commented 3 years ago

So, I think the source of this problem is in dplyr, (tidyverse/dplyr#5541), but here is a workaround. There is no need to order the tsibble if there are no rows, so skip the step that causes the crash.

library(tsibble)
grped_ped <- pedestrian %>% dplyr::group_by(Sensor)
grped_ped[0, ]
#> # A tsibble: 0 x 5 [?] <Australia/Melbourne>
#> # Key:       Sensor [0]
#> # Groups:    Sensor [?]
#> # ... with 5 variables: Sensor <chr>, Date_Time <dttm>, Date <date>,
#> #   Time <int>, Count <int>

Created on 2020-09-29 by the reprex package (v0.3.0)