Detect and extract matching strings -- ignoring case.

Return TRUE in position where name of x is in y; FALSE otherwise.

extract_insensitive(x, y)

detect_insensitive(x, y)

Arguments

x

A string to be muted as in y, it a case insensitive match is found.

y

A string to use as a reference to match x.

Value

detect_* and extract_* return a logical vector and a string.

See also

Other functions for developers: check_crucial_names(), flag_if_group(), is_multiple(), nms_try_rename(), rename_matches(), type_ensure()

Other general functions to deal with names: rename_matches()

Examples

x <- c("stemid", "n")
y <- c("StemID", "treeID")
detect_insensitive(x, y)
#> [1]  TRUE FALSE
extract_insensitive(x, y)
#> [1] "StemID" "n"     

vft <- data.frame(TreeID = 1, Status = 1)
extract_insensitive(tolower(names(vft)), names(vft))
#> [1] "TreeID" "Status"
extract_insensitive(names(vft), tolower(names(vft)))
#> [1] "treeid" "status"