gpt4 book ai didi

r - GoogleVis 图表未在 Rmarkdown 中呈现

转载 作者:行者123 更新时间:2023-12-02 20:39:56 26 4
gpt4 key购买 nike

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

查看器输出:

enter image description here

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

---
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 block 必须声明为:

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

“asis”很重要,因为它返回原始 HTML

关于r - GoogleVis 图表未在 Rmarkdown 中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36608234/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com