I want to create a function to automatically correct single backslashes to double backslashes since R gives an error if you copy paste a path due to a single backslash. But when I try this, it gives an error:
> x<-gsub("\", "\\", "pak\istan")
Error: unexpected '\\' in "x<-gsub("\","\"
Then I tried this and got the same error again:
> x<-gsub("\", "\\", "pak\istan", fixed=TRUE)
Error: unexpected '\\' in "x<-gsub("\","\"
How can I fix it?