Remove a prefix or suffix from a character vector.
Value
x is returned with the specified prefix or suffix
removed from each element where it was present.
Details
Elements without the specified prefix or suffix will remain
unchanged. An error will occur if prefix or suffix is NA.
Examples
x <- c("x_apple", "x_banana", "x_cherry")
rm.prefix(x, "x_")
#> [1] "apple" "banana" "cherry"
rm.suffix(x, "_cherry")
#> [1] "x_apple" "x_banana" "x"
