Even more convincing than nchar is cat vs. print:
s <- "nchar(str)
>#[1] 15
>
>
>It is there just to escape the double quotes.
>if you want a backslash you would need to escape it, like in str1.
>
>
>str1 = 'nchar(str1)
>#[1] 16
>
>
>Now yes, you can remove it.
>
>str2 <- gsub("\\", "", str1, fixe
Hello,
The backslash is not a character of the string str. test it with nchar:
str = '
Hi,
I have below string where I am trying to remove Backslash from. I tried
with gsub() function, however failed to remove that:
str = '
Error in gsub("\\", "", str) :
invalid regular expression '\', rea
2 matches
Mail list logo