r-lib / vctrs

Generic programming with typed R vectors

Home Page:https://vctrs.r-lib.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider adding a parameter to make `vec_match()` and `vec_in()` case insensitive

arnaudgallou opened this issue · comments

It's fairly common to want to match values independently from the case. Although it's easy to lower case the input data, having a parameter to do it would make it even easier and reduce cognitive load.

# tends to be easier to read
vec_match(needles, haystack, ignore_case = TRUE)

# than
vec_match(tolower(needles), tolower(haystack))

Thanks, but I think in this case it is better to keep vec_match() and vec_in() as generic as possible, and let other helpers like tolower() take care of normalizing the input if that is required.