【发布时间】:2017-09-18 21:10:51
【问题描述】:
我想在 Rmarkdown 生成的 html 文件中插入一个 pdf 图形。这是我的test.Rmd:
---
title: "knit include_graphics"
author: "D Li"
date: "4/21/2017"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
```{r out.width=800}
knitr::include_graphics("/Users/dli/Dropbox/UFL/SFL/Doc_beta_div/ecoregions_all.pdf")
sessionInfo()
```
这是我的会话信息:
## R version 3.3.2 (2016-10-31)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: macOS Sierra 10.12.4
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] backports_1.0.5 magrittr_1.5 rprojroot_1.2
## [4] tools_3.3.2 htmltools_0.3.5 yaml_2.1.14
## [7] Rcpp_0.12.10 stringi_1.1.2 rmarkdown_1.4.0.9001
## [10] knitr_1.15.19 stringr_1.2.0 digest_0.6.12
## [13] evaluate_0.10
然后使用 Rstudio 版本 1.0.136 中的knit 按钮,我得到一个test.html 文件。插入的图显示在 RStudio 查看器面板和 Safari 中。但它不会在 Chrome 或 Firefox 中显示。有没有人有同样的问题?我该如何解决?
谢谢。
【问题讨论】:
标签: html r pdf knitr r-markdown