gpt4 book ai didi

R Markdown 中的 rChart 不呈现

转载 作者:行者123 更新时间:2023-12-04 23:48:37 25 4
gpt4 key购买 nike

当我将 R Markdown 文档编织到 html 时,我在渲染用“nPlot”制作的 rChart 时遇到问题。

我遵循了此 question 中讨论的解决方案,但没有成功。

这是我的 .Rmd 代码

```{r, echo=FALSE}
library(knitr)
```
---
title: "Untitled"
author: "Test"
date: "01/23/2015"
output: html_document
---

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r}
summary(cars)
```

You can also embed plots, for example:

```{r, echo=FALSE}
plot(cars)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

# Here is an rChart
```{r, echo=FALSE, results='asis', comment=NA}
library(rCharts)
m2 <- nPlot(speed ~ dist, data = cars, type = "scatterChart")
m2$show('iframesrc', cdn = TRUE)
```
That was an rChart

这是一个 link从该代码到 html 文档。我在 RStudio 中制作和创作了这个,但在我的本地机器上和上传到 Dropbox 时渲染都无法显示。

当我在控制台中运行以下代码并另存为 html 时,我得到 this rendering .
library(rCharts)
m2 <- nPlot(speed ~ dist, data = cars, type = "scatterChart")
m2$save('test3.html', standalone = TRUE)

最佳答案

知道了。

看到这个答案:Ramnath layin' it down

(意识到我们只是在看过时的教程/演练...)

最后一行应该是

n1$print('iframesrc', cdn =TRUE, include_assets=TRUE)

我认为那里的大多数教程都使用旧版本或其他东西。但以上对我有用,所以试一试。

然后编织,然后你就可以开始了。还要确保您的 rCharts 库是最新的
install_github("ramnathv/rCharts")

关于R Markdown 中的 rChart 不呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28120267/

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