mercredi 27 février 2019

Ifelse Statement to Replace Value in Corresponding Row

I have a dataframe like below:

 Col1     Col2     COl4    Col5
   A         B       NA      NA
   M         L       NA      lo
   A         N       NA      KE

How do I make the logic where, if Col1 = A, replace NA in COl4 with "Pass"?

When I try using ifelse, I do not get the expected output.

Expected output should be:

 Col1     Col2     COl4    Col5
   A         B     Pass      NA
   M         L       NA      lo
   A         N     Pass      KE

Aucun commentaire:

Enregistrer un commentaire