Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Starting from gsk3's Seb's suggestions, here's an idea:</p> <ul> <li>the combination of username (login) and IP or name of the computer could be used to select the right directory.</li> </ul> <p>That leads to something like:</p> <pre><code> setwd (switch (paste (Sys.info () [c ("user", "nodename")], collapse="."), user.laptop = "~/Messungen", user2.server = "~/Projekte/Projekt/", )) </code></pre> <p>So there is an automatic solution, that</p> <ul> <li>works with <code>source</code></li> <li>works with <code>Sweave</code></li> <li><p>even works for interactive sessions where the commands are sent line by line</p></li> <li><p>the combination of <code>user</code> and <code>nodename</code> of course needs to be specific</p></li> <li>the paths need to be edited by hand, though.</li> </ul> <p>Improvements welcome!</p> <hr> <p>Update:</p> <p>Gabor Grothendieck answered the following to a related question on r-help today:</p> <pre><code>this.dir &lt;- dirname(parent.frame(2)$ofile) setwd(this.dir) </code></pre> <p>which will work for <code>source</code>. </p> <hr> <p>Another update: I now do most of the data analysis work in RStudio. RStudio's projects basically solve the problem: RStudio changes the working directory to the project root directory every time I switch between projects.</p> <p>I can therefore put the project directory as far down my directory tree as I want (and the students can also put their copy wherever they want) and sync the data files and scripts/<code>.Rnw</code>s via version control (We use a private git server). The RStudio project files are kept out of the version control, i.e. <code>.gitignore</code> contains <code>.Rproj.user</code>.</p> <p>Obviously, <em>within</em> the project, the directory structure needs to be synchronized.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload