tsibble
tsibble copied to clipboard
can't make summarise out of tsibble grouped object
HI, Trying to use this tool. I'm able to get the tsibble object from an irregular timing dataframe with: *i have no key
weather_x <- x %>%
as_tsibble(
index = date_n_time,
regular=FALSE)
the result
> weather_x
# A tsibble: 4,198 x 15 [!] <UTC>
date_n_time temperatura humedad potencial_matriz mojado_hoja mojado_text
<dttm> <dbl> <dbl> <dbl> <dbl> <chr>
1 2022-04-07 19:44:57 21.7 70.1 3861 1005 seco
2 2022-04-07 19:51:03 21.6 70.5 3774. 1005 seco
But, when i try to get regular intervals and summarise i get only one value, and not one fore every hour (in the hourly example). According to the next code.
weather_x2<- weather_x %>%
index_by(date_hour = ~round_date(., unit = "1 hour")) %>%
summarise(temp=max(temperatura))
if i just get the object with the grouping produced by index_by it works ok and produces the next result.
> weather_x2
# A tsibble: 4,198 x 16 [!] <UTC>
# Groups: @ date_hour [431]
date_n_time temperatura humedad potencial_matriz mojado_hoja mojado_text
<dttm> <dbl> <dbl> <dbl> <dbl> <chr>
1 2022-04-07 19:44:57 21.7 70.1 3861 1005 seco
2 2022-04-07 19:51:03 21.6 70.5 3774. 1005 seco
If somebody has any idea of how to solve this would be appreciated. Would love to use this package and I get stuck at the beginning.
Thanks!!
Can you provide a minimal reproducible example using reprex?