setting wd to parent directory ("..") of rmd file for all chunks of .Rmd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

setting wd to parent directory ("..") of rmd file for all chunks of .Rmd

Nevil Amos
The Rmarkdown cookbook states that the working directory for r chunks in an
Rmd file is usually the directory containing the file,
 however it can be reset using

knitr::opts_knit$set(root.dir =

see:
https://bookdown.org/yihui/rmarkdown-cookbook/working-directory.html#working-directory
I want to set the directory to the parent direcotry of the default directory
usually I would acheive this using  setwd("..") so  in the rmd I used the
following:

```{r setup, include=FALSE,}
print(getwd())
knitr::opts_knit$set(root.dir = '..')
print(getwd())
```
the  print(getwd()) being just to demonstrate the result.  There is no
change in the directory.
How do I change the working directory ?

thanks

nevil Amos

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.