EdwinTh / padr

Padding of missing records in time series
https://edwinth.github.io/padr/
Other
132 stars 12 forks source link

Error if you call thicken on data frame with zero rows #60

Closed duju211 closed 5 years ago

duju211 commented 6 years ago

If I call the thicken function on a data frame with zero rows:

library(tidyverse)
library(nycflights13)
library(lubridate)
#> 
#> Attache Paket: 'lubridate'
#> The following object is masked from 'package:base':
#> 
#>     date
library(padr)

flights %>% 
  mutate(date = make_date(year = year, month = month, day = day)) %>% 
  filter(date > Sys.Date()) %>% 
  thicken(interval = "month", by = "date")

I get the following error message:

#> Error in `[.default`(dt_var, 1:(length(dt_var) - 1)) : 
  only 0's may be mixed with negative subscripts
EdwinTh commented 6 years ago

Thanks, will include an informative error.

EdwinTh commented 5 years ago

Reopening, because it was lost in a patch release and I made a mistake in the branching. Needs to be added again.