Thanks for your help. This helped with converting the character date to 'date' recognition. One follow-up though with a small issue to subsetting, below for examples:
#run provided code:
flights <- nycflights13::flights %>%
unite("date", year:day) %>%
mutate(date = ymd(date))
date_test <- subset(flights, date == ymd("2013-01-02"))
#count frequency of flights on that day
count(date_test, "date")
A tibble: 1 x 2
"date" n
1 date 943
Add second date
lights <- nycflights13::flights %>%
date_test <- subset(flights, date == ymd("2013-01-02", "2013-04-03"))
count(date_test, "date")
A tibble: 1 x 2
"date" n
1 date 968
add third date
flights <- nycflights13::flights %>%
- unite("date", year:day) %>%
- mutate(date = ymd(date))
date_test <- subset(flights, date == ymd("2013-01-02","2013-04-03","2013-05-12"))
Warning message:
In ==.default(date, ymd("2013-01-02", "2013-04-03", "2013-05-12")) :
longer object length is not a multiple of shorter object length
count(date_test, date)
A tibble: 3 x 2
date n
1 2013-01-02 314
2 2013-04-03 331
3 2013-05-12 299
Your clarification on this is highly appreciated.
Cheers