[R] Looking up the directory a file is located in
Cliff Clive
cliffclive at gmail.com
Wed Nov 17 22:08:38 CET 2010
Hello everyone,
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
> setwd("C:/Rprojects")
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
this:
> 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,
Cliff
--
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
mailing list