如何使用 r'path\to\directory' 在 Windows 操作系统中设置 R 中的路径?



在windows操作系统(OS(中,对于python,我可以使用os.chdir(r"pathtodirectory")。有没有什么方法可以用类似的方式在R中设置路径?。

我知道的一种方法是setwd(readClipboard())。(采用剪贴板中的路径,Ctrl+C(。

这个问题的目的是,我每次都需要将符号更改为/来设置Windows操作系统中的路径。

R使用与C++、类似的原始字符串语法

r"(pathtodirectory)"

setwd(R"(pathtodirectory)")

以及来自?Quotes:的一些进一步的例子

r"(c:Program filesR)"
## More raw strings:
r"{(12)}"
r"(use both "double" and 'single' quotes)"
r"---(1--)-)---"

最新更新