transform string to first capitalized, except join words*. A gsub to be used easily with native pipe |> gsub2 is just a wrapper around gsub

gsub2(x, arg1, arg2 = "", ic = FALSE, ...)

Arguments

x

data to search

arg1

pattern

arg2

replacement

...

arguments passed to gsub.

Examples

c("a", "b", "c", "d") |> gsub2("a", "x")
#> [1] "x" "b" "c" "d"
# in the case of character
"a b c d" |> gsub2("a", "x")
#> [1] "x b c d"
# If no second argument is provided, than it will erase the pattern:
"'bla bla1 'bla" |> gsub2("'")
#> [1] "bla bla1 bla"