The example with some dates and transformation into date
library(lubridate)
date <- c('2018-01-09', '2018-01-10')
date = ymd(date)
I'm trying to extract month and day from the dates and keep them in one column of date-class:
date <- format(date, "%m-%d")
the class is changed from date
to chr
, but I want to keep the date
class. What should I do?