many thanks! ill try going down the environment variables path as i kind of know how to do it.
abhisek On Sun, Aug 29, 2010 at 9:25 PM, Gabor Grothendieck <ggrothendi...@gmail.com > wrote: > On Sun, Aug 29, 2010 at 1:13 PM, Abhisek <shi...@gmail.com> wrote: > > Hi there, > > > > Ive tried trawling the lists for a solution but I could not find any > > matches. I am typing up all my code on a Linux machine and I call this > > other script file from my script file using source("foo.r"). Now > sometimes > > i access my folder from my Windows machine at work (the files are on > > dropbox). But of course my windows machine would not understand the > linux > > path name. > > > > Is there any syntax for searching the file system for "foo.r" from within > > the script file that I am writing? I know that I can always change the > > working directory to the one where the script file is stored but is there > > any other way? > > > > Thanks! > > Abhisek Banerjee > > > > You could (1) use file.exists to successively check specific paths. > It will return FALSE if the path does not exist letting you skip over > the bad paths. See ?file.exists > > You could alternately (2) set an option in the your .Profile on both > machines (?options, ?getOption, ?Startup), (3) outside of R set up > environment variables on both machines reading them in with Sys.getenv > or (4) set up configuration files (e.g. a file with just one line > giving the path to the file) which you read in from your home > directory e.g., readLines("~/.myconfig") Note that ~ works from > within R even on Windows and forward slashes work in Windows filenames > from within R as well as backslashes. > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com > [[alternative HTML version deleted]] ______________________________________________ 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.