So, let's say I have data with a column date.
library(dplyr)
library(lubridate)
df <- data.frame(
nr = c(1, 2),
date = c(20170131, 20081028)
)
df2 <- df %>%
mutate(date = ymd(date))
Now my data has the dates in proper date format year-month-date. But what if I want to change that to d-m-y format in one statement? The only solution I have is with the format function. But is there a lubridate solution as well?
df3 <- df2 %>%
mutate(date = format(date, "%d/%m/%Y"))