Solution
Try this: x <- read.csv("C:/Users/surfcat/Desktop/2006_dissimilarity.csv", header=TRUE)
Explanation
R is not able to understand normal windows paths correctly because the "\"
has special meaning - it is used as escape character to give following characters special meaning (\n
for newline, \t
for tab, \r
for carriage return, ..., have a look here ).
Because R does not know the sequence \U
it complains. Just replace the "\"
with "/"
or use an additional "\"
to escape the "\"
from its special meaning and everything works smooth.
Alternative
On windows, I think the best thing to do to improve your workflow with windows specific paths in R is to use e.g. AutoHotkey which allows for custom hotkeys:
- define a Hotkey, e.g. Cntr-Shift-V
- assigns it an procedure that replaces backslashes within your Clipboard with
slaches ...
- when ever you want to copy paste a path into R you can use Cntr-Shift-V instead of Cntr-V
- Et-voila
AutoHotkey Code Snippet (link to homepage)
^+v::
StringReplace, clipboard, clipboard, \, /, All
SendInput, %clipboard%