demo_data() |>
add_date_columns(date_col = date)
# if columns overlap, you will see a warning
demo_data() |>
dplyr::mutate(week = 1) |>
add_date_columns(date_col = date)
# to drop the old column and keep the new column use `drop = TRUE`
demo_data() |>
dplyr::mutate(week = 1) |>
add_date_columns(date_col = date, drop = TRUE)
Run the code above in your browser using DataLab