You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both ifelse & dplyr::if_else expect a vector, not a scalar, condition; i.e. mutate doesn't do any "looping" for you over values in the column. So the expected use of ifelse or dplyr::if_else is that your condition is already vectorized, and hence the looping happens via that vectorization.
In this case I believe you just need to switch to str_split and use lengths() rather than length:
I can not understand why the value in the example below is treated as a vector and not scalar, when I try to put a simple string condition:
Results in error:
My question is if only way to approach
mutate
with customized condition is withmap
iterator? This works, though does not look nice:Is there any other way, am I getting something wrong?
The text was updated successfully, but these errors were encountered: