I want to set the day of month in a Date to start date of current month (01). Now I use the following:
Date
01
currentDate <- Sys.Date()
Using lubridate (also work with sec, min, hour, mon, year etc.)
lubridate
sec
min
hour
mon
year
library(lubridate) dt <- Sys.Date() day(dt) <- 01 dt # [1] "2018-01-01"