igrepHas | R Documentation |
vector contains any case-insensitive grep match
igrepHas(
pattern,
x = NULL,
ignore.case = TRUE,
minCount = 1,
naToBlank = FALSE,
...
)
pattern |
the grep pattern to use with |
x |
vector to use in the grep |
ignore.case |
logical default TRUE, meaning the grep will be performed in case-insensitive mode. |
minCount |
integer minimum number of matches required to return TRUE. |
naToBlank |
logical whether to convert NA to blank, instead of allowing grep to handle NA values as-is. |
This function checks the input vector for any elements matching the grep pattern. The grep is performed case-insensitive (igrep). This function is particularly useful when checking function arguments or object class, where the class(a) might return multiple values, or where the name of the class might be slightly different than expected, e.g. data.frame, data_frame, DataFrame.
logical indicating whether the grep match criteria were met, TRUE indicates the grep pattern was present in minCount or more number of entries.
base::grep()
Other jam grep functions:
grepls()
,
igrepl()
,
igrep()
,
provigrep()
,
unigrep()
,
unvigrep()
,
vgrep()
,
vigrep()
a <- c("data.frame","data_frame","tibble","tbl");
igrepHas("Data.*Frame", a);
igrepHas("matrix", a);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.