图像未显示在 R notenook 中(nb.html 文件)

Images not showing in R notenook (nb.html file)

当我编织到 HTML 时,图像在 .html 文件中显示正常,但在 .nb.html 文件中显示不正常。 MWE 是 R Notebook 模板:plot(cars) 图片不显示。

根据此处列出的建议:,我尝试了 older/newer/dev 版本的 rmarkdown。我还尝试了 newer/dev 个版本的 knitr。没有任何帮助。我有 RStudio 版本 1.0.136.

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5

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     

other attached packages:
[1] devtools_1.12.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8     withr_1.0.2     digest_0.6.11   rprojroot_1.2       R6_2.2.0       
 [6] jsonlite_1.2    backports_1.0.5 git2r_0.15.0    magrittr_1.5    evaluate_0.10  
[11] highr_0.6       httr_1.2.1      stringi_1.1.2   curl_2.3        rstudioapi_0.6 
[16] rmarkdown_1.3   tools_3.3.2     stringr_1.1.0   yaml_2.1.14     rsconnect_0.7  
[21] base64enc_0.1-3 memoise_1.0.0   htmltools_0.3.5 knitr_1.15.8   

感谢 RStudio 指出这是预期的行为。我在控制台中将块输出设置切换为块输出,这样我就可以在绘图 window 中查看绘图。我没有意识到所有块都必须 运行 内联才能出现在笔记本中。我切换回块输出内联,运行 块,一切都很好。