问题
I am trying to publish rCharts in knitrHTML, I keep getting this error:
Quitting from lines 11-43 (ddd.Rmd)
Error in file(con, "w") : cannot open the connection
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> <Anonymous> -> writeLines -> file
Execution halted
this is my kode within the markdown:
rPlot(cpubusy ~ datetime, color = 'machine', type = 'point', data = server)
How could I resolve this? what am I missing?
回答1:
See - Ramnath answer.
Basically to add rCharts and have it rendered within knitr you need to the print method and include_assets = TRUE. This will tell knitr to add the JS and CSS assets required for rCharts.
Also make sure you have {r results = 'asis', comment = NA} for your chunk.
```{r results = 'asis', comment = NA}
p <- rPlot(speed ~ dist, data = cars, type = 'point')
p$print('chart', include_assets = TRUE)
```
来源:https://stackoverflow.com/questions/33288134/how-do-you-publish-rcharts-with-knithtml