R/wide2long.R
grepl_fix.Rd
Matches pattern to vector based on match type
grepl_fix(data, pattern, type = c("prefix", "infix", "suffix"))
vector
pattern(s) to match. Character vector of length 1 or more.
type of match. can be one of "prefix","infix" or "suffix".
logical vector
c("id", "age", "weight_0", "weight_1") |> grepl_fix(pattern = c("_0", "_1"), type = "suffix") #> [1] FALSE FALSE TRUE TRUE