R/rename_matches.R
extract_insensitive.Rd
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)
A string to be muted as in y
, it a case insensitive match is
found.
A string to use as a reference to match x
.
detect_*
and extract_*
return a logical vector and a string.
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()
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"