How do I replace the + with %2B:
Here is my code
x<-\"asflj + ldjjsf ljsdlafj\" gsub(\"+\",\"%2B\", x)
my output is:
+ is a metacharacter then you can set fixed=TRUE to skip it and get what you need.
fixed=TRUE
> gsub("+","%2B", x, fixed=TRUE) [1] "asflj %2B ldjjsf ljsdlafj"
Or skip it by using \\+
\\+
> gsub("\\+","%2B", x) [1] "asflj %2B ldjjsf ljsdlafj"