mardi 17 août 2021

Conditional nested IF in R

I have a column that contains some values as follows: 0 to 6 Each value refers to account type, whether revenue, expense etc

I am trying to use IF to look for the value and assign it its correct classification.

I have tried the following but it didn't work. account_type <- if(df$class = 0) {account_type = 'Suspense'} else if (df$class = 1) {account_type = 'Asset'}

I do appreciate your help. I would also appreciate it if you combine an explanation.

Thanks,

Aucun commentaire:

Enregistrer un commentaire