title: In RStudio/RMarkdown, how to setwd?
body: <p><code>setwd</code> in an Rmd file in RStudio does not appear to change the directory in subsequent chunks.  Is there a way to set the working directory for good?</p>
  
  <p>Example:</p>
  
  <pre><code>```{r}
  setwd("/tmp")
  getwd()
  ```
  
  ```{r}
  getwd()
  ```
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>setwd("/tmp")
  getwd()
  ## [1] "/private/tmp"
  
  getwd()
  ## [1] "/Users/me/src"
  </code></pre>
  
  <p>This is on Mac OS 10.8.5 using RStudio 0.97.551, R version 3.0.2 and knitr version 1.5.</p>
  
  <p>I wish to set the directory once for all subsequent chunks.</p>