I have the following data frame
filen<-c('510-1','510-2','510-2','510-2','510-3','510-3','510-4')
disp<-c('g','ng','ng','ng','g','ng','ng')
df<-data.frame(filen,disp)
filen disp
1 510-1 g
2 510-2 ng
3 510-2 ng
4 510-2 ng
5 510-3 g
6 510-3 ng
7 510-4 ng
Basically I want to isolate the file numbers where ng
is the only type of disp associated with that filen. So that I get a dataset like this. How do I do this using dplyr
filen disp
510-2 ng
510-4 ng