The arguments come in pairs: a question, then what it gives. The first question that is true wins, so the order is part of what the sentence means. Ask the same two the other way round and the answers change, which is not a trap but the thing you are choosing when you write them in an order:
Error:
!
illegal: `when` gives one column, so all of its answers have to be the same kind of thing. One of them is text and this is a number
|
2 | then add [band] as when(([score] >= 90), "A", otherwise 0)
| ^
illegal: `when` gives one column, so all of its answers have to be the same kind of thing. One of them is text and this is a number
|
2 | then add [band] as when(([score] >= 90), "A", otherwise 0)
| ^
Python has a conditional of its own, and it is worth saying why god does not use it. Writing "A" if col.score >= 90 else "B" would decide the answer once, while the pipeline was being built, and throw the question away. Nothing would report a problem. R has no such expression at all. So the word is when in both, and it is the same word in the text form.