本文介绍了Knitr无法呈现googleVis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 7中使用Rsutdio和knitr渲染简单的gvisTable时遇到麻烦.这是我的代码

I have a trouble with Rsutdio and knitr in Windows 7 for rendering a simple gvisTable. Here is my code

```{r results='asis'}
require(googleVis)
op <- options(gvis.plot.tag="chart")
data(iris)
t = gvisTable(data = iris)
print(t)
```

这是我的错误:

我的Rstudio版本是:0.98.1091我的SessionInfo是:

My Rstudio version is : 0.98.1091And my SessionInfo is :

R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plotrix_3.5-10   data.table_1.9.4 googleVis_0.5.6  knitr_1.8       

loaded via a namespace (and not attached):
 [1] chron_2.3-45     digest_0.6.4     evaluate_0.5.5   formatR_1.0      htmltools_0.2.6  plyr_1.8.1       Rcpp_0.11.3     
 [8] reshape2_1.4     RJSONIO_1.3-0    rmarkdown_0.3.11 stringr_0.6.2    tools_3.1.2      yaml_2.1.13

或此代码可以正常工作:

or this code works perfectly fine :

```{r results='asis'}
require(knitr)
data(iris)
kable(iris)
```

在这种情况下,您对googleVis的问题有任何想法吗?预先感谢您的帮助.

Do you have any idea of the problem with googleVis in this context ? Thanks in advance for any help.

推荐答案

Pandoc尝试下载googleVis图表,以便它可以在您的文档中嵌入静态/离线副本.您可以通过告诉Pandoc不要创建一个独立的文档来解决该问题(即不要执行导致问题的资源嵌入)-将其添加到文档的顶部,或者将---之间的文本添加到您的文档顶部已经有一个YAML标头:

Pandoc is trying to download the googleVis chart so that it can embed a static/offline copy in your document. You can work around the problem by telling Pandoc not to create a standalone document (i.e. don't do the resource embedding that's causing the problem)--add this to the top of your document, or just the text between --- if you already have a YAML header:

---
output:
  html_document:
    self_contained: no
---

Pandoc通过HTTPS获取资源应该没有问题.如果您有时间在rmarkdown工作流程之外(例如,在原始Markdown-> HTML转换上)重现该问题,并发现仍然存在问题,请为Pandoc提交问题: https://github.com/jgm/pandoc/issues .

Pandoc shouldn't have a problem fetching resources over https. If you have time to repro the problem outside the rmarkdown workflow (i.e. on a vanilla Markdown -> HTML conversion) and find that it's still an issue, please file an issue for Pandoc: https://github.com/jgm/pandoc/issues.

这篇关于Knitr无法呈现googleVis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 02:14