I have a dataframe that looks like this, but with a larger number of rows:
id status year
1 yes 2013
1 no 2013
1 yes 2014
3 no 2012
4 yes 2014
6 no 2014
I'd like to filter the dataframe so that if the id and year column are the same between two rows, but the status column is different, only the row with the 'yes' status remains. If there's a 'no' for an id and year combination that doesn't have a 'yes' associated with that, I'd still like to keep that. This leads me to the issue of not being able to just filter the status column to only have rows with 'yes'.
This leads me to the issue of not being able to just filter the status column to only have rows with 'yes'.
The resulting data frame should look like this, where the second row on the first data frame would be taken out because ID 1 and year 2013 has a 'yes' associated with it. However rows with IDs 3 and 6 remain because there is no yes associated with those ID and year combinations:
id status year
1 yes 2013
1 yes 2014
3 no 2012
4 yes 2014
6 no 2014