2
I have the following table df
Valor DebCred
100 C
200 D
300 C
I have to create a logic that is the following if Table DebCred for C I have to multiply Valor * -1,00 and if it equals D multiply Valor*0.
I made a code that would be the following
IF (df$DebCred == C){
df$Cred <- df$Valor * -1
}else{
df$Cred <- df$Valor * 0
}
IF (df$DebCred == D){
df$Deb <- df$Valor * 1
}else{
df$Deb <- df$Valor * 0
}