如何在r中提取数据帧中考虑其他列条件的列的日期



我有一个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

相关内容

  • 没有找到相关文章

最新更新