【发布时间】:2015-01-23 23:14:26
【问题描述】:
当我将 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
这是来自该代码的 html 文档的 link。我在 RStudio 中制作和创作了这个,但渲染在我的本地机器上和上传到 Dropbox 时都无法显示。
当我在控制台中运行以下代码并另存为 html 时,我得到this rendering。
library(rCharts)
m2 <- nPlot(speed ~ dist, data = cars, type = "scatterChart")
m2$save('test3.html', standalone = TRUE)
【问题讨论】:
标签: r nvd3.js r-markdown rcharts