I have a panel data frame like this:
test <- data.frame(id = c("A", "A", "A", "B", "B"), year = c("2014", "2015", "2016", "2014", "2015"), income = c("100", "150", "200", "300", "200"))
Suppose 2015 is when the "treatment" took place.
Now, I would like to keep only those observations from which data are available both before and after 2015. In other words, my expected data frame will exclude all B's. Any input would be highly appreciated. Thanks.