Skip to contents

Expand date range to include all dates

Usage

expand_date_range(x, name)

Arguments

x

<date> vector of dates

name

<chr> new column name for vector of dates

Value

<tbl> with expanded date range

Examples

expand_date_range(
   seq.Date(
   from = as.Date("2020-01-01"),
   to = as.Date("2020-01-01") + 2057,
   by = 1),
   "date"
)
#> # A tibble: 2,058 × 10
#>    date        year quarter month month_l  week   day  yday  wday wday_l
#>    <date>     <int>   <int> <int> <ord>   <int> <int> <int> <int> <ord> 
#>  1 2020-01-01  2020       1     1 Jan         1     1     0     3 Wed   
#>  2 2020-01-02  2020       1     1 Jan         1     2     1     4 Thu   
#>  3 2020-01-03  2020       1     1 Jan         1     3     2     5 Fri   
#>  4 2020-01-04  2020       1     1 Jan         1     4     3     6 Sat   
#>  5 2020-01-05  2020       1     1 Jan         1     5     4     7 Sun   
#>  6 2020-01-06  2020       1     1 Jan         1     6     5     1 Mon   
#>  7 2020-01-07  2020       1     1 Jan         1     7     6     2 Tue   
#>  8 2020-01-08  2020       1     1 Jan         2     8     7     3 Wed   
#>  9 2020-01-09  2020       1     1 Jan         2     9     8     4 Thu   
#> 10 2020-01-10  2020       1     1 Jan         2    10     9     5 Fri   
#> # ℹ 2,048 more rows