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

can't make summarise out of tsibble grouped object #280

Open
jimoreira opened this issue Apr 25, 2022 · 1 comment
Open

can't make summarise out of tsibble grouped object #280

jimoreira opened this issue Apr 25, 2022 · 1 comment

Comments

@jimoreira
Copy link

jimoreira commented Apr 25, 2022

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!!

@earowang
Copy link
Member

earowang commented Oct 9, 2022

Can you provide a minimal reproducible example using reprex?

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

No branches or pull requests

2 participants