I am having issues rendering an rChart made with 'nPlot' when I knit an R Markdown document to html.
I followed the solution discussed in this question, but it was unsuccessful.
Here is my .Rmd code
```{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
Here is a link to the html document from that code. I produced and authored this in RStudio and the rendering fails to show up both on my local machine and when uploaded to Dropbox.
When I run the following code in console and save as an html, I get this rendering.
library(rCharts)
m2 <- nPlot(speed ~ dist, data = cars, type = "scatterChart")
m2$save('test3.html', standalone = TRUE)
GOT IT.
see this answer: Ramnath layin' it down
(chest-swelling feeling of satisfaction quickly deflated upon realization we were just looking at outdated tutorials / walkthroughs...)
last line should be
n1$print('iframesrc', cdn =TRUE, include_assets=TRUE)
I think most of the tutorials out there are using an old version or something. But the above works for me, so give it a shot.
then knit, then you're good to go. Also make sure you're rCharts library is up to date
install_github("ramnathv/rCharts")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With