Knitr无法渲染googleVis。

8

我在Windows 7上使用Rsutdio和knitr渲染简单的gvisTable时遇到了问题。这是我的代码:

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

以下是我的错误信息:

pandoc.exe: 无法检索 https://www.google.com/jsapi?callback=displayChartTableID14c4345d7f3 FailedConnectionException2 "www.google.com" 443 True connect: failed (Connection timed out (WSAETIMEDOUT)) 错误:pandoc 文档转换失败,错误代码为 61

我的 Rstudio 版本号为:0.98.1091 并且我的 SessionInfo 如下:

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

这段代码可以正常运行:
```{r results='asis'}
require(knitr)
data(iris)
kable(iris)
```

你有没有关于在这种情况下使用googleVis遇到的问题的想法?提前感谢您的任何帮助。

1个回答

11

为了将一个 GoogleVis 图表嵌入到您的文档中,Pandoc 正在尝试下载它以便插入一个静态/离线副本。 您可以通过告诉 Pandoc 不要创建独立文档(即不要进行资源嵌入,这是导致问题的原因)来解决该问题——将以下内容添加到您的文档顶部,或者如果您已经有了 YAML 标头,则仅添加 --- 之间的文本:

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

Pandoc不应该在 https 协议下获取资源时出现问题。如果您有时间在 rmarkdown 工作流之外(即在纯Markdown -> HTML转换中)复现该问题,并发现它仍然存在,请为Pandoc提交一个问题报告:https://github.com/jgm/pandoc/issues


1
devtools::install_github('mages/googleVis') 这个命令对我来说也可以。 - Rγσ ξηg Lιαη Ημ 雷欧

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接