[R] Looking up the directory a file is located in
cliffclive at gmail.com
Wed Nov 17 22:08:38 CET 2010
This should be an easy question, I think.
I'd like to write a command in a program to set the working directory to
whatever directory the file is currently stored in. Suppose I have a file
called "myRscript.r", and it's stored in "C:\Rprojects\myRscript.r", and it
references other R scripts and data files in the same directory.
If I enter the command
I can then access all the files I need without typing the path.
But suppose I want to move all of those files into another folder, say,
"C:\NewFolder". And suppose I might do this fairly often, or make copies of
the script in several folders. Is there a command that looks something like
> setwd( <look up current directory> )
that will work no matter where I move my project, without having to go in
and re-type the new directory path?
Thanks in advance,
View this message in context: http://r.789695.n4.nabble.com/Looking-up-the-directory-a-file-is-located-in-tp3047649p3047649.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help