I am attempting to parse a character vector that has dates represented by following character format: SEP0, OCT0...JAN1, etc. The SEP is the month, and the 0 or 1 is the year 2020 or 2021, etc. I am trying to convert the characters into a dates with the following format: 2020-09-01, 2020-10-01...2021-01-01, etc. I'm trying different things with lubridate, but I can't seem to get it to work. Still very new with dates, so I'm likely messing something up here.
Thanks in advance.
######## converting character to dates ########
data <-c("SEP0", "OCT0", "DEC0", "JAN1")
new_data <- as_date(data, "ymd") # failed
new_data2 <- mutate(data, Year = year(Mth), Month = month(Mth), Day = "01",
date = as_date(paste0(Year, Month,"01"))) # also failed