编织 HTML 后如何强制 knitr 删除支持目录(.png 文件)

How do I force knitr to delete support directory (.png files) after HTML is knitted

RStudio Edition : Preview
RStudio Version : 1.2.1335
OS Version      : Windows 7 Pro
R Version       : 3.5.3

当我在 R Studio 中将 .Rmd 文件编织到 .html 时,在父目录中创建了两个项目:

  1. 所需的文件,例如project-name.html
  2. 支持 .png 文件的不需要目录 \...\project-name_files

我假设这个 \project-name_files 应该被自动删除,但是这并没有发生。如果我尝试删除此 \project-name_files 目录,我的 project-name.html 文件也会被删除。

\project-name_files 目录和 project-name.html 以一种我什至都不知道可能的方式被牢固地 link 编辑。如果我将 单独 从硬盘驱动器上的位置 A 移动到位置 B,它们会彼此跟随,两者都会移动,就好像它们被永久地 linked 一样。我只选了一个,他们两个怎么动?我从来没有见过这样的事情,也不知道 Windows O/S 是怎么允许的!我知道有符号 links 但这更像是一个永久不可见的 link.

无论如何,如果这是预期的行为,我不会提交错误报告(是吗?)。如果这是预期的行为,我该如何禁用它?我希望在创建 .html 文件后删除支持文件目录 (.pngs)。

> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices
[4] utils     datasets  methods  
[7] base     

other attached packages:
[1] forcats_0.4.0   stringr_1.4.0  
[3] dplyr_0.8.0.1   purrr_0.3.2    
[5] readr_1.3.1     tidyr_0.8.3    
[7] tibble_2.1.1    ggplot2_3.1.1  
[9] tidyverse_1.2.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1       cellranger_1.1.0
 [3] pillar_1.3.1     compiler_3.5.3  
 [5] plyr_1.8.4       tools_3.5.3     
 [7] packrat_0.5.0    jsonlite_1.6    
 [9] lubridate_1.7.4  gtable_0.3.0    
[11] nlme_3.1-137     lattice_0.20-38 
[13] pkgconfig_2.0.2  rlang_0.3.4     
[15] cli_1.1.0        rstudioapi_0.10 
[17] haven_2.1.0      withr_2.1.2     
[19] xml2_1.2.0       httr_1.4.0      
[21] generics_0.0.2   hms_0.4.2       
[23] grid_3.5.3       tidyselect_0.2.5
[25] glue_1.3.1       R6_2.4.0        
[27] readxl_1.3.1     modelr_0.1.4    
[29] magrittr_1.5     backports_1.1.4 
[31] scales_1.0.0     rvest_0.3.3     
[33] assertthat_0.2.1 colorspace_1.4-1
[35] stringi_1.4.3    lazyeval_0.2.2  
[37] munsell_0.5.0    broom_0.5.2     
[39] crayon_1.3.4   

When in doubt, try to upgrade your packages. This is a known bug in rmarkdown v1.12 (your session info didn't show the version of rmarkdown), and has been fixed a while ago on Github. The current CRAN version of rmarkdown, v1.13,包含错误修复。