I'm hoping there is a simple solution, apologies if I haven't provided enough information - please let me know if I should add any other info.
I'm trying to render two pngs to a pdf. When I manually knit to PDF in RStudio, the images are included as expected. However, when I try to use the Rmarkdown::render function the pdf shows

as text instead of the image.
Here is my rmd:
---
fontfamily: helvet
geometry: margin=0.5in
header-includes:
- \usepackage{booktabs}
- \usepackage{longtable}
- \usepackage{array}
- \usepackage{multirow}
- \usepackage{wrapfig}
- \usepackage{float}
- \usepackage{colortbl}
- \usepackage{pdflscape}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
- \usepackage{makecell}
- \usepackage{xcolor}
- \renewcommand{\familydefault}{\sfdefault}
output:
pdf_document:
latex_engine: pdflatex
---
```{r message=FALSE, warning=FALSE}
library(knitr)
df <- data.frame(
stock = c('Apple','Amazon','Microsoft','Tesla'),
value = c(300,200,150,250),
difference = c(50,-10,20,-15)
)
df$trend <- ifelse(df$difference >0,
'',
''
)
kable(df)
```
I don't receive any error that it can't find the pngs, and it doesn't appear that it's even looking. Here is how I'm using the render function, I've tried adding an output_file and output_dir argument but neither do the trick. I also added envir = new.env() to guarantee an empty new environment as recommended here: Why does rendering a pdf from rmarkdown require closing rstudio between renders?, but that did not work either.
rmarkdown::render('C:/Users/Desktop/Notes/test.Rmd',pdf_document(latex_engine = "pdflatex"), envir = new.env())