I refer to Oscar de Léon's answer to this question: How to add column into a dataframe based on condition?
This is his code:
iris$Regulation <- c("DOWN", "UP")[ (iris$Sepal.Length >= 5) + 1 ]
I understand it assigns values to the column "Regulation" and hence creates it, if it's not there yet. But then? I see it works but I don't understand what it is exactly doing. Could you explain what it does?