html - 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?
解决方案
推荐阅读
- python - 获取英国财政年度的一周
- c++ - 使用 cmake 所需的 Boost 组件
- vuejs2 - Vuex 分离文件 getters.js 和带参数的 getter
- fortran - Fortran DATA 语句中的字符串连接
- html - CSS 搜索按钮样式被用户代理样式表覆盖
- bash - Bash试图将转换后文件的名称写入文本
- python - 为什么 QWidget 不显示在 QMainWindow 上?
- spring - Spring Controller 从不同的网站获取变量
- r - 如果我的操作按钮导致应用程序崩溃,我如何在 Shiny 中返回错误
- javascript - 如何在打字稿中定义动态通用约束