起始R:错误:'\ U'在字符串中以十六进制数字开头使用"C:\ U"

ant*_*lth 3 windows r tex knitr

启动RStudio时以及尝试从.rnw格式编译PDF时出现以下问题:

Error: '\U' used without hex digits in character string starting ""C:\U"
Run Code Online (Sandbox Code Playgroud)

启动RStudio或只是R这是我的控制台内部:

R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Global .Rprofile loaded!

Error: '\U' used without hex digits in character string starting ""C:\U"
Run Code Online (Sandbox Code Playgroud)

当我尝试编译PDF时会发生这种情况:

Global .Rprofile loaded!

Error: '\U' used without hex digits in character string starting ""C:\U"
Execution halted
Run Code Online (Sandbox Code Playgroud)

这种情况从一天到另一天出现,我不确定发生了什么变化.我尝试更新RStudio和我的R版本,但它没有帮助.我正在Windows上运行R.

有人可以帮我解决这个问题吗?

ant*_*lth 6

毕竟我实际上能够解决这个问题:

我的.Rprofile文件(在Documents中)中有一个部分,带有"\"而不是"/".所以我现在改变了

# Set mainfolder for PACKAGE package
options(PACKAGE_MAINFOLDER="C:\Users\...")
Run Code Online (Sandbox Code Playgroud)

# Set mainfolder for PACKAGE package
options(PACKAGE_MAINFOLDER="C:/Users/...")
Run Code Online (Sandbox Code Playgroud)

这就是诀窍.


小智 6

要使其正常工作,只需删除C:\Users\edmar.campos.cardoso\Dropbox\并将其全部替换\/使用函数setwd()更改R.

错误的方法:

setwd('C:\Users\edmar.campos.cardoso\Dropbox\...')
Run Code Online (Sandbox Code Playgroud)

正确的方法:

setwd('/Users/edmar.campos.cardoso/Dropbox/...')
Run Code Online (Sandbox Code Playgroud)