Selecting Specific Dates in R

后端 未结 2 1715
被撕碎了的回忆
被撕碎了的回忆 2021-01-28 05:49

I am wondering how to create a subset of data in R based on a list of dates, rather than by a date range.

For example, I have the following data set data wh

2条回答
  •  一整个雨季
    2021-01-28 06:12

    Lets assume your breezedate list looks like this and data$date is simple string:

      breezedate <- as.Date(c("2009-09-06", "2009-10-01"))
    

    This is probably want you want:

      breezedays <- data[as.Date(data$date, '%m/%d/%Y') %in% breezedate]
    

提交回复
热议问题