[R] Re placing a "+" in a string

Tom La Bone booboo at gforcecable.com
Thu May 21 17:45:19 CEST 2009

I know this is easy, but I am stumped:
> gsub("0","K","8.00+00")
[1] "8.KK+KK"

> gsub("+","K","8.00+00")
Error in gsub("+", "K", "8.00+00") : invalid regular expression '+'
In addition: Warning message:
In gsub("+", "K", "8.00+00") :
  regcomp error:  'Invalid preceding regular expression'

I don't understand the error message. How do I go about replacing the "+" in
the string "8.00+00" with another character?


View this message in context: http://www.nabble.com/Replacing-a-%22%2B%22-in-a-string-tp23655515p23655515.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list