Remove duplicate rows based on two columns keeping the row that has value in another column

Priyanka Basu Source

I have a dataset from where I need to remove duplicate rows. But the row that will remain is dependent on the value in another column.

Example dataset:

Name     Surname    Place
A        B          <NA>
A        B          C
A        B          D
M        P          <NA>
M        P          J
L        T          <NA> 
X        Y          <NA> 

Expected dataset:

Name     Surname    Place
A        B          C
A        B          D
M        P          J
M        P          <NA>
L        T          <NA> 
X        Y          <NA> 
rdplyr

Answers

comments powered by Disqus