Closed emitanaka closed 3 years ago
Can you set the “regular=FALSE” when you make the tsibble?
Sent from my iPhone
On 1 Nov 2020, at 9:11 pm, Emi Tanaka notifications@github.com wrote:
I have an irregular time interval (3 days, then 7 days later on) but it shows up as 1 day in the tsibble header.
library(tsibble) df <- data.frame(eggID = "208", day = c(0, 3, 6, 9, 12, 15, 21, 28, 36, 45)) df
> eggID day
> 1 208 0
> 2 208 3
> 3 208 6
> 4 208 9
> 5 208 12
> 6 208 15
> 7 208 21
> 8 208 28
> 9 208 36
> 10 208 45
df %>% as_tsibble(index = day, key = eggID)
> # A tsibble: 10 x 2 [1]
> # Key: eggID [1]
> eggID day
>
> 1 208 0
> 2 208 3
> 3 208 6
> 4 208 9
> 5 208 12
> 6 208 15
> 7 208 21
> 8 208 28
> 9 208 36
> 10 208 45
Created on 2020-11-01 by the reprex package (v0.3.0.9001)
Session info — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Ah, so it doesn't automatically detect that for me and requires me to know the structure of the data beforehand then.
I have an irregular time interval (3 days, then 7 days later on) but it shows up as 1 day in the tsibble header.
Created on 2020-11-01 by the reprex package (v0.3.0.9001)
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.1 (2020-06-06) #> os macOS Catalina 10.15.7 #> system x86_64, darwin17.0 #> ui X11 #> language (EN) #> collate en_AU.UTF-8 #> ctype en_AU.UTF-8 #> tz Australia/Melbourne #> date 2020-11-01 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> anytime 0.3.9 2020-08-27 [1] CRAN (R 4.0.2) #> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.0.0) #> backports 1.1.10 2020-09-15 [1] CRAN (R 4.0.2) #> cli 2.1.0 2020-10-12 [1] CRAN (R 4.0.2) #> crayon 1.3.4 2017-09-16 [2] CRAN (R 4.0.0) #> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2) #> dplyr 1.0.1 2020-07-26 [1] Github (tidyverse/dplyr@16647fc) #> ellipsis 0.3.1 2020-05-15 [2] CRAN (R 4.0.0) #> evaluate 0.14 2019-05-28 [2] CRAN (R 4.0.0) #> fansi 0.4.1 2020-01-08 [2] CRAN (R 4.0.0) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2) #> generics 0.0.2 2018-11-29 [2] CRAN (R 4.0.0) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2) #> highr 0.8 2019-03-20 [2] CRAN (R 4.0.0) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2) #> knitr 1.29 2020-06-23 [1] CRAN (R 4.0.2) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.0) #> lubridate 1.7.9 2020-06-08 [2] CRAN (R 4.0.1) #> magrittr 1.5 2014-11-22 [2] CRAN (R 4.0.0) #> pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.1) #> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.0.0) #> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.0.0) #> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2) #> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.0) #> reprex 0.3.0.9001 2020-08-08 [1] Github (tidyverse/reprex@9594ee9) #> rlang 0.4.8 2020-10-08 [1] CRAN (R 4.0.2) #> rmarkdown 2.3 2020-06-18 [1] CRAN (R 4.0.2) #> rstudioapi 0.11 2020-02-07 [2] CRAN (R 4.0.0) #> sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 4.0.0) #> stringi 1.4.6 2020-02-17 [2] CRAN (R 4.0.0) #> stringr 1.4.0 2019-02-10 [2] CRAN (R 4.0.0) #> styler 1.3.2 2020-02-23 [1] CRAN (R 4.0.1) #> tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.2) #> tidyselect 1.1.0 2020-05-11 [2] CRAN (R 4.0.0) #> tsibble * 0.9.3.9000 2020-11-01 [1] Github (tidyverts/tsibble@e749eb6) #> utf8 1.1.4 2018-05-24 [2] CRAN (R 4.0.0) #> vctrs 0.3.2.9000 2020-07-26 [1] Github (r-lib/vctrs@df8a659) #> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2) #> xfun 0.16 2020-07-24 [1] CRAN (R 4.0.2) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.2) #> #> [1] /Users/etan0038/Library/R/4.0/library #> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library ```