On Thu, Nov 18, 2010 at 12:00 AM, Cliff Clive <cliffcl...@gmail.com> wrote: > > Basically I'm just looking for a command that can look up the name of the > directory of the script that is running. If I move or copy the script to > another directory, it should be able to read the name of the new directory > without me having to edit the code. > > Once I have identified the directory, I can insert it into the setwd() > command and continue with my program.
This is a fairly-frequently asked question, and the questioner is rarely satisfied with the answer. How is your script starting? Either: a) R is starting in that directory, so that the working directory is already set, or b) Whatever runs the script knows where it is in order to start it, so could pass that directory to the script somehow, either by a global parameter, or an environment variable. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.