We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
library(tsibble) library(lubridate) flights <- nycflights13::flights %>% mutate( sched_dep_datetime = make_datetime(year, month, day, hour, minute, 0), flight_num = paste0(carrier, flight) ) flights_tsbl <- flights %>% as_tsibble( key = id(flight_num), index = sched_dep_datetime, regular = FALSE )
The key should be updated from flight_num to origin, not NULL.
flight_num
origin
NULL
flights_tsbl %>% group_by(origin) %>% summarise(avg_delay = mean(dep_delay, na.rm = TRUE)) #> # A tsibble: 199,339 x 3 [!] #> origin sched_dep_datetime avg_delay #> * <chr> <dttm> <dbl> #> 1 EWR 2013-01-01 05:15:00 2 #> 2 EWR 2013-01-01 05:58:00 -4 #> 3 EWR 2013-01-01 06:00:00 0.2 #> 4 EWR 2013-01-01 06:07:00 0 #> 5 EWR 2013-01-01 06:08:00 24 #> 6 EWR 2013-01-01 06:10:00 -4 #> 7 EWR 2013-01-01 06:15:00 0 #> 8 EWR 2013-01-01 06:30:00 -4.25 #> 9 EWR 2013-01-01 06:36:00 8 #> 10 EWR 2013-01-01 06:45:00 15.3 #> # ... with 199,329 more rows
Created on 2018-08-06 by the reprex package (v0.2.0).
The text was updated successfully, but these errors were encountered:
Fixed key updating via group_by() + summarise(). #47
group_by()
summarise()
fe11389
No branches or pull requests
The key should be updated from
flight_num
toorigin
, notNULL
.Created on 2018-08-06 by the reprex
package (v0.2.0).
The text was updated successfully, but these errors were encountered: