我有一个1200行的大数据集,看起来像这样:
日期 | CAL_CALFIX | |
---|---|---|
2015-07-20 | 是 | 否|
2015-07-21 | 是 | 否 |
2015-07-22 | 否 | 否|
2015-07-23 | 否 | 是 |
2015-07-24 | 否 | 否|
2015-07-25 | 是 | 是|
2015-07-26 | 否 | 否|
当您发布带有数据的图像时,有点难以理解数据的结构。您可以查看此链接https://stackoverflow.com/help/how-to-ask.
利用你的资料和图书馆的资料,我相信我已经得到了你的答案。
library(tidyverse)
df<-data.frame(Date=seq(as.Date("2015-07-20"), as.Date("2015-07-26"), by="day"),
CAL_CALFIXO=c("yes","yes","no", "no", "no","yes", "no" ),
FIXOCAL=c("no","no","no","yes","no","yes","no")) # The DF with your data
Date<-df%>%filter(., CAL_CALFIXO=="yes"&FIXOCAL=="yes")%>% #Filter extract the columns with the desired characteristics
select(., Date)# with Select I am choosing to save only the Column Date in a new Dataframe.
我的输出是:
>Date
Date
1 2015-07-25