Yes you first example shows what case_when
does by design: It evaluates all the RHS before filtering to the correct condition, so yes all the assignment are made.
switch
is a better candidate here. I don't think case_when
is thought to be used this way. It is for assigning the result of case_when
to a variable.
@Isaiah, if your question is resolved, can you mark the topic as solved.(FAQ: How do I mark a solution?)