- Is there some trick with a named list to easily do case_when or case_match in #rstats?
- I don't know if it fits your use case, but str_replace_all can replace with a named vector. You might need to add "\\b" around the input to make sure it doesn't match partials, or wrap it with "^" and "$" for an exact match.Jun 23, 2025 19:34
- I also wrapped this into a function for one of my packages, so I can just pass on two vectors of the same length to str_replace_all without creating a named vector manually beforehand