What does “evaluate chunks in directory” do?

What, exactly, does “evaluate chunks in directory” in the R Markdown settings do?

If I set it to “Document” and then run a chunk in an Rmd file, it runs in the current R working directory—not the directory of the Rmd file.

  • Is this the expected behavior?
  • Does that mean the setting only applies when knitting?
  • If so, does this mean knitr will ignore `knitr::opts_knit$set(
  • root.dir = path)`

You may find interesting this chapter of the R Markdown Cookbook

It explains how it works in general and the different options to tweak it.

Hope it helps