I have a data frame with multiple observations for each ID like this:

**edit**: updated data frame

```
df <- data.frame(ID=c(1,1,1,2,2,3,3,3,4), V1=c("A","B","C","A","A","B","B","C","A"),
             V2=rnorm(9))

> df
  ID V1          V2
1  1  A  1.57707547
2  1  B -0.76022296
3  1  C -0.82693346
4  2  A  1.80888747
5  2  A -0.53173950
6  3  B -1.18705727
7  3  B  0.04325324
8  3  C -0.33361802
9  4  A -0.02358198

```

Now I want to select all rows per ID in the following way:

* If ID has observations for "A", select these rows
* If ID has observations for "B", select these rows
* If ID has observations for both "A" and "B", select only rows with "A"

In my example I want to have this:

```
    ID V1          V2
  1  1  A  1.57707547
  2  2  A  1.80888747
  3  2  A -0.53173950
  4  3  B -1.18705727
  5  3  B  0.04325324
  6  4  A -0.02358198

```

I'd also like to see a `dplyr` solution if applicable.