mercredi 14 août 2019

Is there an R code or function that can help me with if statement with multiple condition

I'm cleaning up my dataset after I join multiple dataframe. I'm trying to find a code or a logic way to tell R to do the following by using if statement with multiple conditions:

IF Var1 = value any value (1 up 100) but Var2 doesn't have a value then Var 3 = Var1

IF Var2 = value any value (1 up 100) , Var1 = no value or missing then Var 3 = Var2

IF Var1 = value any value (1 up 100) , = value any value then Var 3 = (Va1+Va2/2)

Can you please help me set-up this if-statement condition?

Thank you

Aucun commentaire:

Enregistrer un commentaire