I want to replace '\' by '/' regardless of how many times it is present in the input string.
I have read these : Replace "\" with "/" in r
Efficiently convert backslash to forward slash in R
But both of them gives solution where the directory_path is read through clipboard paste or through scan().
I want to give directory path as a variable.
Example Code :
directory_path = 'D:\demo\app'
gsub( '\', '/', directory_path )
But it is giving error.
> directory_path = 'D:\demo\app'
Error: '\d' is an unrecognized escape in character string starting "'D:\d"