I'm making a 'Make your own graph tutorial' using Rmarkdown, I have a dataset with a date variable (format: day-month-year), using dmy(variable) I can correctly class the variable as a 'Date' variable (format:year-month-day).
Users have to filter based on this date, and seeing as Dutch people use the day-month-year format I want to allow them to filter based on this format. (I could simply tell them to filter in the year-month-day format but this complicates the exercise.)
Goal of question: getting R to recognize a variable as date, but using a day-month-year format
date <- "28-02-2020"
date <- as.Date(date, "%d-%m-%Y")
class(date)
again: date now gives "2020-02-28" - I want "28-02-2020" (with class: Date)