Using webshot inside knitr

In the process of finding a solution to this SO question about saving the heat map created d3heatmap, I encountered an unrelated problem using the development versionwebshot inside (HT: hrbrmstr ).knitr

library(devtools)
devtools::install_github('yihui/knitr', build_vignettes = TRUE)
library(knitr)

After installing and downloading the development version, knitrI tried to run the following .Rmdfile:

---
title: "Untitled"
output: pdf_document
---

```{r}
library(d3heatmap)
d3heatmap(mtcars, scale = "column", colors = "Spectral")
```

I was asked to install phantomjs:

webshot::install_phantomjs()

phantomjs.exe has been installed to /Users/USERNAME/Library/Application Support/PhantomJS

I tried to run the file again .Rmd, but got this error:

sh: ~/Library/Application Support/PhantomJS/phantomjs: No such file or directory
Quitting from lines 7-9 (test.Rmd) 
Error in (function (url = NULL, file = "webshot.png", vwidth = 992, vheight = 744,  : 
  webshot.js returned failure value: 127
Calls: <Anonymous> ... html_screenshot -> in_dir -> do.call -> <Anonymous>
Execution halted

I believe that the error tells me that R cannot find phantomjs.exe, but I see that it is located at the specified path. I know this shouts out a stupid user error.

+4
1

​​ -.

+2

All Articles