rstudio – Using raw string in code snippet in R studio
It is possible in R to denote a string (a file path for example) as a raw string in R by using r"(...)".
I am trying to write a code snippet in R studio to automatically ‘correct’ pasted file paths, i.e convert ‘\’ to ‘\\’. However when I try to use r"(...)" in a code snippet the ‘\’ s aren’t converted just removed.
Running in the console
`r"(C:\fake\directory\path)"`
gives
"C:\\fake\\directory\\path"
I have created a code snippet
snippet !
`r r"($$)"`
But when I run
!C:\fake\directory\path
The result is
C:fakedirectorypath
Am I missing something here or are raw strings just not able to be used in code snippets?
Also, if not is there another way of achieving what I want?
Read more here: Source link
