Skip to content
Prev 176948 / 398503 Next

toupper does not work in sub + regex

The easiest way to do that is to use Gabor's gsubfn package.
There doesn't appear to be a \\<letter> code that means don't convert
the rest of the replacement items to upper or lower case.

You could use other methods to avoid gsubfn.  E.g.,
  > sub("(q_)([a-z])", "\\U\\2", "q_sviRaw",perl=TRUE)
  [1] "SviRaw"