Firstly I should make the obligatory plea to pose your question as a reproducible example (Check out FAQ: What's a reproducible example (`reprex`) and how do I do one? for details).
In the case when I need my ifelse
to have complex logic, this sounds like the switch
.
https://www.rdocumentation.org/packages/base/versions/3.4.3/topics/switch