GoogleVis chart not rendering in Rmarkdown

给你一囗甜甜゛ 提交于 2020-04-13 06:58:07

问题


Outside of Rmarkdown the stand alone googleVis chart works fine, but when I plug it in the Rmarkdown file I am receiving just the Rmarkdown Code:

Viewer Output:

> TEST H 4/13/2016 require(googleVis) Loading required package:
> googleVis Welcome to googleVis version 0.5.10 Please read the Google
> API Terms of Use before you start using the package:
> https://developers.google.com/terms/
> 
> Note, the plot method of googleVis will by default use the standard
> browser to display its output.   See the googleVis package vignettes
> for more details, or visit http://github.com/mages/googleVis.   To
> suppress this message use:
> suppressPackageStartupMessages(library(googleVis))
> 
> dttm = data.frame(DT_ENTRY=Sys.Date()-1:20,variable="x",value=1:20)
> g1=gvisAnnotationChart(dttm,datevar="DT_ENTRY",numvar="value",idvar="variable")
> plot(g1) starting httpd help server ... done

Rmarkdown Code Below:

---
title: "test"
author: "H"
date: "4/13/2016"
output: html_document
highlight: tango
number_sections: yes
---

```{r}
require(googleVis)
dttm = data.frame(DT_ENTRY=Sys.Date()-1:20,variable="x",value=1:20)
g1=gvisAnnotationChart(dttm,datevar="DT_ENTRY",numvar="value",idvar="variable")
plot(g1)
```

回答1:


The r chunk has to be declared as:

```{r plotg0,  results='asis', tidy=FALSE, echo=FALSE}

The "asis" is important because it returns raw HTML



来源:https://stackoverflow.com/questions/36608234/googlevis-chart-not-rendering-in-rmarkdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!