I'm trying to use regular expression in a sub() function in order to replace all the "\" in a Vector
I've tried a number of different ways to get R to recognize the "\":
- I've tried "
\\\
" but I keep getting errors. - I've tried "
\.*
" - I've tried "
\\\.*
"
data.frame1$vector4 <- sub(pattern = "\\\", replace = ", data.frame1$vector4)
The \
that I am trying to get rid of only appears occasionally in the vector and always in the middle of the string. I want to get rid of it and all the characters that follow it.
The error that I am getting
Error: '\.' is an unrecognized escape in character string starting "\."
Also I'm struggling to get Stack to print the "\" that I am typing above. It keeps deleting them.