When filter some days value from dataframe, I have to repeat 'as.Date' many times in filter condition sentence. Is there any way to simplify it? Thanks!
library(tidyverse)
test_data <- data.frame(mday=seq.Date(as.Date('2021-1-1'),
as.Date('2021-12-30'),by="1 day"),
value=rnorm(364))
# can't work
test_data %>% filter(mday %in% c(as.Date('2021-1-1','2021-7-1','2021-10-7')))
# can work, but have to repeat 'as.date' many times
test_data %>% filter(mday %in% c(as.Date('2021-1-1'),
as.Date('2021-7-1'),
as.Date('2021-10-7')))