GoogleVis图表未在Rmarkdown中呈现 [英] GoogleVis chart not rendering in Rmarkdown

查看:115
本文介绍了GoogleVis图表未在Rmarkdown中呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Rmarkdown之外,单独的googleVis图表可以正常工作,但是当我将其插入Rmarkdown文件时,我仅收到Rmarkdown代码:

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:

查看器输出:

> 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代码如下:

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)
```

推荐答案

r块必须声明为:

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

便捷性"很重要,因为它会返回原始HTML

The "asis" is important because it returns raw HTML

这篇关于GoogleVis图表未在Rmarkdown中呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆