I have a data.frame that collects data related to flights: which plane, the area over which it flies and when it entries and exits that area under a certain date format (2016-07-20 21:20:27). What I would like the code to do for me, is to eliminate the flights that doesn´t take place a certain date (2016-07-21), that implies 3 possible circumstances:
a) Flight enters the area on date different from (2016-07-21) but exits on (2016-07-21) : this flight should NOT be eliminated from the data.frame.
b) Flight enters the area on (2016-07-21) and exits also on (2016-07-21) : this flight should NOT be eliminated from the data.frame.
c) Flight enters and exits the area on date different from (2016-07-21) : this flight should be eliminated from the data.frame.
In my data.frame there is one column that identifies the flight, the area, the date it enters and the date it exits. I show a short reprex of how I have structured the data.frame.
Flight_Info <- data.frame(stringsAsFactors=FALSE,
Flight = c(1, 2, 3),
Area = c("A", "B", "C"),
Date_IN = c("2016-07-20 00:20:27", "2016-07-21 00:20:27",
"2016-07-20 00:20:27"),
Date_OUT = c("2016-07-21 21:20:27", "2016-07-21 21:20:27",
"2016-07-20 21:20:27")
)
In the example, the 3 possibilities are shown. As can be seen, flight 1 and 2 should remain in the data.frame but flight 3 shouldn't as it satisfies possibility c)
Thanks in advance for your help!