In windows operating system (OS), for python, I can use os.chdir(r"path\to\directory\")
. Is there any way that I can set the path in R
also in similar way?.
One of the way known to me is setwd(readClipboard())
. (Taking path in clipboard, Ctrl+C).
The purpose of the question is that, I need to everytime change the symbol \
to /
to set the path in Windows OS.
R uses raw string syntax similar to C++,
r"(path\to\directory)"
or
setwd(R"(path\to\directory)")
with some further examples from ?Quotes
:
r"(c:\Program files\R)"
## More raw strings:
r"{(\1\2)}"
r"(use both "double" and 'single' quotes)"
r"---(\1--)-)---"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.