Is there build-in ifelse() function for vectors?

In R, if I apply ifelse( u > v, 1, 0) for two vectors u and v, it returns a vector containing 1 and 0 with the same length as u and v.

In Stan, seems to me that the conditional operator condition ? 1:0 can only be used for real variables? So is there an equivalent function in Stan for vectors?


Currently I don’t think this exists but I think it’s a good idea. For now you could write a user defined function that does this via a loop (the loop won’t be too slow), that way you could still call it like a function in your Stan program.