Wednesday, March 30, 2011

Setting your working directory

You tried to set your working directory using the location listed in the properties tab of your file of interest by coding something like:

> setwd("C:\Users\Me\Documents\Rfolder\lab1")

But you get the following error:

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

Q: What to do???
A: Change all your backslashes \ to forward slashes /

> setwd("C:/Users/Me/Documents/Rfolder/lab1")
> getwd()
[1] "C:/Users/Me/Documents/Rfolder/lab1"

Or you could just shortcut it:
File -> Change dir...

But that may be too easy

No comments:

Post a Comment