R markdown:图 html 文件夹未显示?



嗨,我遇到了一个奇怪的问题,即在编织过程中生成的"figure-html"图形丢失。过去,当我渲染 rmd 文件时,这个文件夹是自动生成的,其中包含我的所有图形。 但是,它不再这样做。

下面是一个通用示例:

---
title: "test"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
html_document:
df_print: paged
number_sections: yes
editor_options:
chunk_output_type: console
fig_caption: yes
pdf_document:
fig_caption: yes
classoption: a3paper
toc: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown

```{r cars}
library(ggplot2)
ggplot(diamonds, aes(x=carat, y=price, color=cut)) + geom_point() + geom_smooth()
```

## 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 utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] compiler_3.5.3  magrittr_1.5    tools_3.5.3     htmltools_0.3.6
##  [5] yaml_2.2.0      Rcpp_1.0.2      stringi_1.4.3   rmarkdown_1.14 
##  [9] knitr_1.24      stringr_1.4.0   xfun_0.8        digest_0.6.20  
## [13] evaluate_0.14

好的,我找到了一个解决方案。在html_document下添加以下内容

output:
html_document:
df_print: paged
self_contained: no
keep_md: yes

此外,如果您想要一个没有依赖关系的 html,您也可以删除self_contained行。

如果这仍然不起作用,请稍微更改标题。 由于某种原因,如果第一次渲染没有生成文件夹(或者更有可能生成但随后自动删除它(,那么后续将不会。

最新更新