tidyverts / tsibble

Tidy Temporal Data Frames and Tools
https://tsibble.tidyverts.org
GNU General Public License v3.0
527 stars 49 forks source link

fill_gaps seems to be not working on yearmonth #307

Closed USMortality closed 4 months ago

USMortality commented 4 months ago

fill_gaps seems to be not working on yearmonth:

harvest <- tsibble(
  date = c(
    make_yearmonth(year = 2000, month = 1),
    make_yearmonth(year = 2000, month = 4)
  ),
  fruit = rep(c("kiwi", "cherry"), each = 1),
  index = date
)

# gaps as default `NA`
fill_gaps(harvest, .full = TRUE)

output:

# A tsibble: 2 x 2 [3M]
      date fruit 
     <mth> <chr> 
1 2000 Jan kiwi  
2 2000 Apr cherry

Expected would be to have it fill Feb, March with fruit = NA.

USMortality commented 4 months ago

Looks like this fixed it: https://stackoverflow.com/a/75981369/2302437