I have the below code where I am trying to compare 2 date columns and filter the data frame based on the condition.
Input:
id ST_DATE ND_DATE SYSDATE S_END_DATE
1 2017-07-28 2017-08-27 2016-11-09 2017-01-08
2 2017-07-28 2017-08-27 2015-12-16 2017-10-19
chargefmv1$ST_DATE=as.Date(chargefmv1$ST_DATE , format = "%Y-%m-%d")
chargefmv1$S_END_DATE=as.Date(chargefmv1$S_END_DATE , format = "%Y-%m-%d")
chargefmv1$ND_DATE=as.Date(chargefmv1$ND_DATE , format = "%Y-%m-%d")
chargefmv1$SYSDATE=as.Date(chargefmv1$SYSDATE , format = "%Y-%m-%d")
chargefmv2 <- chargefmv1 %>% filter((as.Date(ST_DATE) <= as.Date(S_END_DATE))
&& (as.Date(ND_DATE) >= as.Date(SYSDATE)))
It is not throwing me any error or returning the results. Can anyone help me ?