case-insensitive logical grepl
igrepl(..., ignore.case = TRUE)
parameters sent to base::grep()
logical
vector indicating pattern match
This function is a simple wrapper around base::grepl()
which
runs in case-insensitive mode simply by adding default ignore.case=TRUE
.
It is mainly used for convenience.
V <- paste0(LETTERS[1:5], LETTERS[4:8]);
ig1 <- grepl("D", V);
ig2 <- igrepl("D", V);
ig3 <- grepl("d", V);
ig4 <- igrepl("d", V);
data.frame(V,
grepl_D=ig1,
grepl_d=ig3,
igrepl_D=ig2,
igrepl_d=ig4);
#> V grepl_D grepl_d igrepl_D igrepl_d
#> 1 AD TRUE FALSE TRUE TRUE
#> 2 BE FALSE FALSE FALSE FALSE
#> 3 CF FALSE FALSE FALSE FALSE
#> 4 DG TRUE FALSE TRUE TRUE
#> 5 EH FALSE FALSE FALSE FALSE