0

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?

user1471980
  • 10,127
  • 48
  • 136
  • 235

1 Answers1

3

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)
```
Community
  • 1
  • 1
amwill04
  • 1,330
  • 1
  • 11
  • 18
  • @amvill04, when I do p$print('chart', include_assets = TRUE) it prints the values to the document, not the charts. – user1471980 Oct 22 '15 at 19:10
  • @user1471980 have you added `{r results = 'asis', comment = NA}` to your chunk? You need the `results = 'asis'` so `knitr` does not process it further. – amwill04 Oct 22 '15 at 19:18
  • yes, as this ```{r results, echo=FALSE, comment = NA} – user1471980 Oct 22 '15 at 19:20
  • see above. You have missed the `"asis"` for the `result`. It needs to read `{r results = 'asis', comment = NA}` – amwill04 Oct 22 '15 at 19:21