Try base::ifelse() R ifelse() Usage with Examples - Spark By {Examples} (sparkbyexamples.com) or
dplyr::if_else() Vectorised if-else — if_else • dplyr (tidyverse.org)
Also, please make your example reproducible next time with the code you tried.
Try base::ifelse() R ifelse() Usage with Examples - Spark By {Examples} (sparkbyexamples.com) or
dplyr::if_else() Vectorised if-else — if_else • dplyr (tidyverse.org)
Also, please make your example reproducible next time with the code you tried.