When compiling knitr reports, I would like to automatically change the name of the files (eg label-1.pdf) saved on the disc to include the automated numbering of the figures captions (eg Figure-054.pdf).
Example :
---
title: "Test"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.path = 'Figures/', fig.cap = ' ', fig.pos = "H")
```
```{r}
summary(cars)
```
```{r cars}
plot(cars)
```
```{r, fig.cap = 'pressure'}
plot(pressure)
```
```{r}
summary(iris)
```
```{r}
plot(iris)
plot(iris[,1] ~ iris[,5])
```
I obtain 4 file names
cars-1.pdf
unnamed-chunk-2-1.pdf
unnamed-chunk-4-1.pdf
unnamed-chunk-4-2.pdf
I would like to obtain instead something like this (i.e. corresponding to the numbering in the pdf report) :
Figure-001.pdf
Figure-002.pdf
Figure-003.pdf
Figure-004.pdf
I know that the figures names can be changed with fig.process
knitr
option. But I don't know how I can capture the automated figure number.