I have a data frame of multiple columns. I want to create a new colomn called second.indicator with the following :
second.indicator == -1 if il.count.description + un.count.description > elle.count.description + une.count.description
second.indicator == 0 if il.count.description + un.count.description) == elle.count.description + une.count.description
else second.indicator == 1
the output is many error messages : 'second.indicator' not found / Error: unexpected '}' in " }"
il.count.descrition elle.count.description un.count.description un.count.description
5 1 5 1
9 2 2 6
1 1 0 0
10 9 0 8
data <- data %>%
mutate(second.indicator =
if (il.count.description + un.count.description) > elle.count.description + une.count.description) {
second.indicator == -1
} else if (il.count.description + un.count.description) == (elle.count.description + une.count.description) {
second.indicator == 0
} else {
second.indicator == 1
}