1
votes

Hi I'm experiencing a weird issue whereby figures generated "figure-html" during the knitr is missing. It use to be that when I render an rmd file this folder is automatically generated with all my figures. However, it no longer does this.

Here is an generic example:

---
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
1
It's easier to help you if you include a simple reproducible example with sample input and desired output that can be used to test and verify possible solutions. What exactly does your knitr input look like? Are you creating HTML output? Does the output still work but the images are just in a different place? Have you recently updated your packages? What exactly is your goal (you seem to be relying on some side effects)?MrFlick
@MrFlick the issue is that its happening to all my markdown files. I included a generic example above.Ahdee

1 Answers

1
votes

Ok I found a solution. Under html_document add the following

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

Also you may be able to remove the self_contained line if you want a single html without dependency.

If this still does not work then change the title just a bit. For some reason if the first time render did not produced the folder ( or more likely generated but then automatically deleted it) then subsequent will not.