solution similar to include_graphics that works inside div
I'm trying to determine the best way to include png images inside multiple nested divs within R markdown.
I would love to use knitr::include_graphics()
but unfortunately it doesn't seem to work inside a div.
for example...
lets say I want to create side by side images with two png images.
I would love to use the method below. However, it does not generate the png's properly.
library(shiny)
library(knitr)
div(
div(class="col-md-6", include_graphics("image1.png")),
div(class="col-md-6", include_graphics("image2.png")),
class="row"
)
I'm aware of using things like readPNG
with grid.raster
but don't find they are as useable as knitr::include_graphics()
which seems to render better in Rmarkdown.
Is anyone familiar with any alternatives to knitr::include_graphics
or grid.raster(readPNG())
?
I am also aware of the native knitr way of including images e.g. ![](www/image1.png)
but have not found a way to include this inside many nested HTML divs. And writing raw html e.g. <img>
doesn't recognize the file as an external one, and won't export properly.
Does anyone have any thoughts?