have a lot of date columns in my dataframe and needed to transform all the dates to three new columns per date (day of month, month and year)
I try to avoid to specifically write every column down, so i am using across but still wrapping my mind around this kind of verbs
library(tidyverse)
df <- tibble(dates1 = c("2020-08-03", "2020-08-03"),
dates2 = c("2020-08-05", "2020-08-05"))
df %>% mutate(across(contains("dates"), lubridate::day(.), lubridate::month(.), lubridate::year(.) ))
Error: Problem with `mutate()` input `..1`.
i `..1 = across(...)`.
x do not know how to convert 'x' to class “POSIXlt”
and guessing how the new columns should be named....I am a bit lost