I redirect the output of my Rmd rendering to another folder via output_dir. This creates the intermediate folder <input name>_files in the output directory but I do not want to have the _files folder to be there. Ideally I would not like to have it in the first place but reading Chapter 16.5 in the RMarkdown Cookbok it is a feature and not a bug that the intermediate folder _files is not deleted for self containing files as soon as we have a chunk with cache = TRUE.
I tried to set the intermediate folder via intermediates_dir but to no avail, the _files folder will always be in the output folder.
What can I do to
- Not have this folder (without setting
cache = FALSE)? - And if this is not possible, move the
_filesfolder at least to another place?
Reprex
Create an
RStudioproject and create folderstmpanddocsunder the project root.Press the
knitbutton or PressCtrl+Shift+Kfor the following file namedtest.Rmd:--- title: "Test" knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, intermediates_dir = here::here("tmp"), output_dir = here::here("docs")) }) --- ```{r setup, include = FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ## R Markdown ```{r cars, cache = TRUE} summary(cars) ``` ## Including Plots ```{r pressure, echo = FALSE} plot(pressure) ```You will see now that a folder
test_filesappear underdocsand not undertmp