I am still fairly new to R and still learning the fundamentals. I am using the nycflights13 data built into R and am trying to figure out the number of flights on certain days, i.e. holidays. I have tidy verse and lubridate packages uploaded
So far I have tried this:
year, month, and day are separate so I try to unite them
flights <- nycflights13::flights %>%
- unite("date", year:day, remove = TRUE)
"date" is created but is not in readable formate for R to subset and I tried I few ways of trying to make it a date but no change with the following in no particular order:
mutate(date = unite(as.Date("year","month", "day")))
nycflights13:flights$date <- as.Date(with(nycflights13:flights, paste(year, month, day,sep="-")), "%Y-%m-%d")
Lastly it is worth noting I am able to do this with one date either with subset or filter i.e.:
daytest <- flights %>%
- subset(date == "2013_1_1")
But as soon as I try to at a second date, I get an error message, so long story short I seem to have minor issues wit fixing how the date is read.
Your help is appreciated.