Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nest() does not respect ordering of keys #57

Closed
mitchelloharawild opened this issue Aug 22, 2018 · 1 comment
Closed

nest() does not respect ordering of keys #57

mitchelloharawild opened this issue Aug 22, 2018 · 1 comment
Assignees
Labels

Comments

@mitchelloharawild
Copy link
Member

mitchelloharawild commented Aug 22, 2018

Critical bug when nesting a tsibble, which causes misalignment of data when nesting. I suspect the issue is caused within nest.tbl_ts.


library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following object is masked from 'package:stats':
#> 
#>     filter
pedestrian_lst <- pedestrian %>%
  arrange(desc(Sensor)) %>% 
  group_by(Sensor) %>% 
  nest

pedestrian_lst %>% 
  filter(Sensor == "Birrarung Marr") %>% 
  unnest
#> # A tsibble: 17,539 x 5 [1h]
#>    Sensor         Date_Time           Date        Time Count
#>    <chr>          <dttm>              <date>     <int> <int>
#>  1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01     0   746
#>  2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01     1   312
#>  3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01     2   180
#>  4 Birrarung Marr 2015-01-01 03:00:00 2015-01-01     3   133
#>  5 Birrarung Marr 2015-01-01 04:00:00 2015-01-01     4    44
#>  6 Birrarung Marr 2015-01-01 05:00:00 2015-01-01     5    16
#>  7 Birrarung Marr 2015-01-01 06:00:00 2015-01-01     6    13
#>  8 Birrarung Marr 2015-01-01 07:00:00 2015-01-01     7    21
#>  9 Birrarung Marr 2015-01-01 08:00:00 2015-01-01     8    39
#> 10 Birrarung Marr 2015-01-01 09:00:00 2015-01-01     9    36
#> # ... with 17,529 more rows

pedestrian %>% 
  filter(Sensor == "Birrarung Marr")
#> # A tsibble: 14,592 x 5 [1h]
#> # Key:       Sensor [1]
#>    Sensor         Date_Time           Date        Time Count
#>    <chr>          <dttm>              <date>     <int> <int>
#>  1 Birrarung Marr 2015-01-01 00:00:00 2015-01-01     0  1630
#>  2 Birrarung Marr 2015-01-01 01:00:00 2015-01-01     1   826
#>  3 Birrarung Marr 2015-01-01 02:00:00 2015-01-01     2   567
#>  4 Birrarung Marr 2015-01-01 03:00:00 2015-01-01     3   264
#>  5 Birrarung Marr 2015-01-01 04:00:00 2015-01-01     4   139
#>  6 Birrarung Marr 2015-01-01 05:00:00 2015-01-01     5    77
#>  7 Birrarung Marr 2015-01-01 06:00:00 2015-01-01     6    44
#>  8 Birrarung Marr 2015-01-01 07:00:00 2015-01-01     7    56
#>  9 Birrarung Marr 2015-01-01 08:00:00 2015-01-01     8   113
#> 10 Birrarung Marr 2015-01-01 09:00:00 2015-01-01     9   166
#> # ... with 14,582 more rows

Created on 2018-08-22 by the reprex package (v0.2.0).

@earowang
Copy link
Member

Closed at b48fb09

It's from split_by().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants