I think I am about to lose my mind!
I need to create a data frame of dates with a column name but I am struggling to figure it out.
I know I can assign the colnames outside of the dplyr chain using colnames(date_df) <- "DATE" but for my own learning I would like to understand if it's possible to do within the dplyr pipe/chain
library(tidyverse)
library(lubridate)
date_df <- seq.Date(from = as.Date(today()- days(7)),
to = as.Date(today()),
by = "day") %>%
as.data.frame(col.names = c("DATE"))
Can someone please put me out of my misery and help me add a column name to this basic problem?
data.frame(DATE = seq.Date(from = as.Date(today()- days(7)), to = as.Date(today()), by = "day"))