Here is a portion of my data:
>head(state1)
># A tibble: 6 x 5
date TYP_INT WEATHER pedday intersection
<date> <dbl> <dbl> <dbl> <dbl>
1 2019-01-02 1 2 0.204 1
2 2019-01-04 1 10 0.204 1
3 2019-01-06 1 1 0.204 1
4 2019-01-07 1 1 0.204 1
5 2019-01-10 1 1 0.204 1
6 2019-01-22 1 1 0.612 1
I want to have this data start at the first day of the year and end at the last day and fill in zeros for missing dates. When I try to change
start_val="2019-01-01"
I get the message that I need to use class Date, POSIXlt, or POSIXct. I also tried %d to make it show all the days but that also did not work.
state1<- read_csv(file.choose())
library(padr)
edit<-state1%>%
padr::pad(start_val = as.Date(start_val="2019-01-01"),end_val = max(.$date)) %>%fill_by_value(value = 0)