lundi 5 juillet 2021

Using IFELSE function across multiple columns

I want to create a new column based on multiple columns of different data types

Names 1 2 3
A 000 NA 030
B 100 DDD NA
C XXX 000 050

Based on column 1-3, I want to add another column with the condition If value >= 30 then 1 else 0.

Output will be:

Names 1 2 3 4
A 000 NA 030 1
B 100 DDD NA 1
C XXX 000 015 0

Note : There are 36 such columns (1-36) across where I want to use the if condition and then create a new column.

Aucun commentaire:

Enregistrer un commentaire