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

nevil amos nev||@@mo@ @end|ng |rom gm@||@com
Thu Mar 25 05:40:20 CET 2021

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 =

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

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


nevil Amos

	[[alternative HTML version deleted]]

More information about the R-help mailing list