Deletion of default figure subdir after preview an md doc

I use the following sequence in spinning r scripts: (i) use knitr::spin on the script, (ii) open the md file, and (3) Use Preview > Preview PDF. In recent times, the last step has resulted in the figure subdirectory being deleted, after the output is created. I can avoid this by checking the Output option "Keep tex source file used to produce PDF" in the Advanced tab of the Preview settings. However, I have to do this every time I preview the md file, something that was unnecessary in the past (and which is not necessary on a colleague's machine).

Here is a reprex that causes the fault:

#'# A reprex for problem where figure directory gets deleted on render of md doc
#'
#'## Running this script produces a plot that is saved in the figure subdirectory of the working directory
library(knitr)
#knitr::spin("figuredel.r")
library(ggplot2)
data("mtcars")
ggplot(mtcars, aes(x = mpg)) + geom_dotplot()

Saving this as a file and running knitr::spin on it as described above produces the fault.

I am running Windows 10, R 3.6.1 and RSTudio 1.2.1555.

Any help to return to a state where the default behaviour is the retention of the figure directory will be greatly appreciated. Chris

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