Change default directory that Rmarkdown uses

Hello community,

I want to start sharing my results of analysis with customer for my Data Science projects at work (using a fat client at work instead of my own laptop) by using the 'Knit' option to cast my Rmarkdown to HTML format. Strange thing is that when I knit the Rmarkdown file it states that my working directory is incorrect:
It's actually incorrect and I want to change it to C:/R...something, but can't find where to edit this. When checking for the working directory in a code chunk of the Rmarkdown itself, it looks like the working directory is just fine and is assigned to the map I want.
Does somebody know how to change this inside Rstudio for Rmarkdown? I have the feeling it's super-simple to find, and I'm completely missing it!

Can somebody help me out on this one?

By default, chunks are evaluated considering the folder containing the Rmd file as the working directory. If you want to change that, you can use setwd function and specify full path of your preferred directory.

Another option may be the knit_root_dir argument if the render function.

Finally, I know that there is a package here which is very popular in this context. Somehow I have never used it, but you may try that out and it may simplify the process as well.

Hope this helps.

Thanks for the option: I sorted it out with the knit_root_dir argument!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.