I have a dataframe (dat), with a "date" variable, which is in the format of dd.mm.yyyy (example: 31.12.2022)
I would like to know how could I reverse it to
yyyy.mm.dd?I also tried to separate
d,m, andy, so that I could re-merge them in a different column, but I am facing problems with this.
dat2 <- separate(data = dat,
col = "date",
sep = ".",
into = c("session_day","session_month", "session_year"))
which is giving this message
Warning message: Expected 3 pieces. Additional pieces discarded in 1566 rows [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
I appreciate any suggestions.
Thank you.