[R-sig-teaching] workspace management

Murray Jorgensen maj at waikato.ac.nz
Tue Nov 2 23:05:29 CET 2010


Actually I find a hard-coded path *especially* useful when I'm using 
more than one computer as it reminds me of what directory I'm suppose to 
be working in.

I write code like

wbf =  #"C:\\Files\\Consulting\\Cilla\\Wetaboxes 1.7.09.csv"
   "C:\\Users\\maj\\Documents\\Consulting\\Cilla\\Wetaboxes 1.7.09.csv"
longterm = read.csv(wbf,header=TRUE)

and move the # around depending on what computer I'm on.

Murray

On 3/11/2010 7:23 a.m., Hadley Wickham wrote:
>> In the real world, there are also strong programming integrity reasons to
>> hard code paths directly into our scripts. This leaves no doubt about what
>> dataset was being analyzed, etc.
>
> The whole point of using a working directory is so that you _don't_
> have to do that.  Any hard coded path makes reproduction on another
> computer a real pain - you should always rely on the analyst setting
> the working directory from outside of the script, otherwise you lose
> most of the advantages of a working directory.
>
> Hadley
>

-- 
Dr Murray Jorgensen      http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: maj at waikato.ac.nz                                Fax 7 838 4155
Phone  +64 7 838 4773 wk    Home +64 7 825 0441   Mobile 021 0200 8350




More information about the R-sig-teaching mailing list