Selecting Specific Dates in R

无人久伴 提交于 2019-12-02 11:07:19

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]

The intersect() function (docs) will allow you to compare one data frame to another and return those records that are the same.

To use, run the following:

breezedays <- intersect(data$date,breezedate) # returns into breezedays all records that are shared between data$date and breezedate
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!