You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the example from the tsibble index_byreference and it's modified version:
tourism %>%
index_by(Year=~ year(.)) %>%
group_by(Region, State) %>%
summarise(Total= sum(Trips))
# A tsibble: 1,520 x 4 [1Y]# Key: Region, State [76]# Groups: Region [76]RegionStateYearTotal<chr><chr><dbl><dbl>1AdelaideSouthAustralia19982226.2AdelaideSouthAustralia19992218.3AdelaideSouthAustralia20002418.
>tourism %>%
+ index_by(Year=~ year(.)) %>%
+ group_by(Region) %>%
+ summarise(Total= sum(Trips))
# A tsibble: 1,520 x 3 [1Y]# Key: Region [76]RegionYearTotal<chr><dbl><dbl>1Adelaide19982226.2Adelaide19992218.3Adelaide20002418.
In the first case:
grouping and summing happened over (Year, Region, State)
result is grouped_ts with Region as a grouped variable
In the second case:
grouping and summing happened over (Year, Region)
result ir tbl_ts
This is not very intuitive, as summary function seems to be "dropping" 2 (?) grouping variables. I expected it to either drop only Year, resulting in grouped_ts in both cases, or to "drop" all variables, resulting in tbs_ts in both cases. Not sure if this is a bug, but even if it isn't, I would have liked to have it mentioned somewhere (together with dplyr::ungroup which I guess I need to use in the first case).
The text was updated successfully, but these errors were encountered:
Consider the example from the tsibble
index_by
reference and it's modified version:In the first case:
In the second case:
This is not very intuitive, as
summary
function seems to be "dropping" 2 (?) grouping variables. I expected it to either drop only Year, resulting in grouped_ts in both cases, or to "drop" all variables, resulting in tbs_ts in both cases. Not sure if this is a bug, but even if it isn't, I would have liked to have it mentioned somewhere (together withdplyr::ungroup
which I guess I need to use in the first case).The text was updated successfully, but these errors were encountered: