0

I want to select all the rows that are equal to specific dates. I tried the following:

dsCorona <- subset(dsCorona, datum == c("2020-03-07", "2020-03-14", "2020-03-21", "2020-03-28",
                                       "2020-04-04", "2020-04-11", "2020-04-18", "2020-04-25", 
                                       "2020-04-30"))

However, this does not seem to work and I end up with the following error:

In datum == c("2020-03-07", "2020-03-14", "2020-03-21", "2020-03-28", : longer object length is not a multiple of shorter object length

Can anyone help me out?

Reinout
  • 29
  • 5

1 Answers1

0

Maybe you should consider use dplyr/tidyverse. If dsCorona is a data.frame (if not, you can cast it), with the dplyr/tidyverse package achive what are you asking would be:

dsCorona <- dsCorona %>% filter(datnum %in% c(...vector of those values)) 

I hope it helps!