library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
DF <- data.frame(
Town =
c("Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Chicago", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland", "Portland"),
Date =
c(2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2019))
DF$Date <- make_date(DF$Date)
towns <- length(unique(DF$Town))
mons <- rep(0:11,towns)
DF$Date = DF$Date + months(mons)
DF
#> Town Date
#> 1 Chicago 2019-01-01
#> 2 Chicago 2019-02-01
#> 3 Chicago 2019-03-01
#> 4 Chicago 2019-04-01
#> 5 Chicago 2019-05-01
#> 6 Chicago 2019-06-01
#> 7 Chicago 2019-07-01
#> 8 Chicago 2019-08-01
#> 9 Chicago 2019-09-01
#> 10 Chicago 2019-10-01
#> 11 Chicago 2019-11-01
#> 12 Chicago 2019-12-01
#> 13 Portland 2019-01-01
#> 14 Portland 2019-02-01
#> 15 Portland 2019-03-01
#> 16 Portland 2019-04-01
#> 17 Portland 2019-05-01
#> 18 Portland 2019-06-01
#> 19 Portland 2019-07-01
#> 20 Portland 2019-08-01
#> 21 Portland 2019-09-01
#> 22 Portland 2019-10-01
#> 23 Portland 2019-11-01
#> 24 Portland 2019-12-01