starting R: Error: '\U' used without hex digits in character string starting “”C:\U"

坚强是说给别人听的谎言 提交于 2020-02-03 08:43:06

问题


I have the following problem when starting RStudio and when I try to compile a PDF from a .rnw format:

Error: '\U' used without hex digits in character string starting ""C:\U"

When starting RStudio or just R this is what is inside my console:

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"

And this happens when I try to compile a PDF:

Global .Rprofile loaded!

Error: '\U' used without hex digits in character string starting ""C:\U"
Execution halted

This kind of appeared from one day to another and I am not sure what has changed. I tried updating RStudio and my R-version, but it did not help. I am running R on Windows.

Can anybody help me with that issue?


回答1:


I was able to solve this after all:

I had a section inside my .Rprofile file (in Documents) with "\" instead of "/". So I now changed

# Set mainfolder for PACKAGE package
options(PACKAGE_MAINFOLDER="C:\Users\...")

to

# Set mainfolder for PACKAGE package
options(PACKAGE_MAINFOLDER="C:/Users/...")

and that did the trick.




回答2:


You can use \\ instead of \. This allows skipping from some characters such as \n which is the end of the line or \t which is tab.




回答3:


To make it work, just remove the C:\Users\edmar.campos.cardoso\Dropbox\ and replace all \ with / using the function setwd() to change the working directory in R.

Wrong way:

setwd('C:\Users\edmar.campos.cardoso\Dropbox\...')

Right way:

setwd('/Users/edmar.campos.cardoso/Dropbox/...')



回答4:


Open the CSV file and Save as the file to your MYDocuments. Then use this

[MyData <- read.csv("Data.csv",header = TRUE)]

if its text just change read.csv to read.text



来源:https://stackoverflow.com/questions/44273571/starting-r-error-u-used-without-hex-digits-in-character-string-starting-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!