3

hoping someone can help me.

I have R 3.2.2 (2015-08-14) and RStudio 0.99.489 on Windows 7. my default working directory is c:\users\adamsben\, but could be anywhere.

I know that when I load a file, such as read.csv("c:\users\adamsben\data.csv") I'll get an error.

Instead I know I need to write: read.csv("c:\\users\\adamsben\\data.csv") or read.csv("c:/users/adamsben/data.csv")

However, I'm getting the same error when I try to compile source code or try to use knitr.

The error I get is:

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

Obviously, the error is related to c:\Users\ but now I'm not sure how to fix. I tried changing my working directory, no dice.

Also, I've tried searching for this error on both stackoverflow and google generally, and all I get are people trying to read in data files and needing to change to \\ or /

An example: trying to install shiny devtools::install_github('rstudio/shinyapps')

Downloading GitHub repo rstudio/shinyapps@master
Installing shinyapps
"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" --no-site-file  \
  --no-environ --no-save --no-restore CMD INSTALL  \
"C:/Users/adamsben/AppData/Local/Temp/RtmpIJ5NwN/devtools19c84a7c5e0b
/rstudio-shinyapps-688a4ac"  \
--library="C:/Users/adamsben/Documents/R/win-library/3.2"  \
--install-tests 

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

I really have no idea how to fix something embedded in someone else's code. Any ideas?

Ben Adams
  • 143
  • 1
  • 2
  • 8
  • 1
    Replace All \ with \\. Reference : http://stackoverflow.com/questions/8425409/file-path-issues-in-r-using-windows-hex-digits-in-character-string-error – Nawazish Abbas Feb 16 '16 at 19:03
  • no, I can't do that. I'm not typing anything into the console with \ or \\. I type: devtools::install_github('rstudio/shinyapps') and then this error occurs. – Ben Adams Feb 29 '16 at 00:31
  • Were you able to fix it? I'm having the same issue and the solution is not replace all backslash \ by double backslash \\ – Marc Mar 15 '19 at 10:37
  • (1) `normalizePath(path, winslash="/")` will shift from back-to-forward slashes, but I think that's not your problem. (2) `install_github` from within something that is `knit`? I think this is a bad practice: if I view somebody's Rmd, it should have no side-effects *on my OS*. Instead, consider using `packrat` (barely around when the Q was asked) or just set up a temporary `.libPath` so that side-effect is managed (perhaps you did and it isn't relevant to the actual question). If it's being `knit` wrong, perhaps `echo=FALSE` or `include=FALSE` in your chunk options to preclude printing it? – r2evans Sep 14 '19 at 15:16

2 Answers2

2

Replace All "\" with double \ in your script Like this Like This

0

Replace All \ with Unix-type forward slash / as an alternative

ipignate
  • 1
  • 1