rknitrrcharts

knitr rchart datatable dtable does not to render


I've read:

and doing that, I still have problems.

I install rCharts doing:

Install rCharts

install.packages("devtools")
library("devtools")
install_github("ramnathv/rCharts")
library("knitr")

If I have a .Rmd like

test.Rmd

```{r ,results='asis', comment= NA,  echo=FALSE}
library(rCharts)
tab2 <-  dTable(as.data.frame(summary(cars)))
# tab2$show('inline', include_assets= TRUE, cdn= TRUE)
tab2$print('chart2', include_assets= TRUE, cdn= TRUE)
```

when I run

knit2html(input = 'test.Rmd', output = 'test.html')

test.html does not render (I tried with tab2$show and tab2$print). But if I open test.html with a editor it can be read the following

<p><link rel='stylesheet' href=//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css></p>
<script type='text/javascript' src=//code.jquery.com/jquery-1.10.2.min.js></script>
<script type='text/javascript' src=//ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js></script> 

which seems to be incorrect because there is no http: at first for every src or href, so I put http: on that changing to

<p><link rel='stylesheet' href=http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css></p>
<script type='text/javascript' src=http://code.jquery.com/jquery-1.10.2.min.js></script>
<script type='text/javascript' src=http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js></script> 

and before that, test.html does render!!. So I don't know if i miss a parameter or this is a bug.


Solution

  • Remove cdn from the print function to use local JS and CSS.

    tab2$print('chart2', include_assets= TRUE)