setwd
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?
Example:
```{r}
setwd("/tmp")
getwd()
```
```{r}
getwd()
```
Output:
setwd("/tmp")
getwd()
## [1] "/private/tmp"
getwd()
## [1] "/Users/me/src"
This is on Mac OS 10.8.5 using RStudio 0.97.551, R version 3.0.2 and knitr version 1.5.
I wish to set the directory once for all subsequent chunks.
knitr
issue. See github.com/yihui/knitr/issues/277#issuecomment-6528846 and see if it helps, though I don't think Yihui is a fan of globally settingsetwd
– Tyler Rinker