在尝试找到有关保存由 生成的热图的SO 问题的解决方案的过程中d3heatmap,我webshot在(HT: hrbrmstr )的开发版本中knitr遇到了一个无关的问题。
library(devtools)
devtools::install_github('yihui/knitr', build_vignettes = TRUE)
library(knitr)
Run Code Online (Sandbox Code Playgroud)
安装并加载开发版后knitr,我尝试运行以下.Rmd文件:
---
title: "Untitled"
output: pdf_document
---
```{r}
library(d3heatmap)
d3heatmap(mtcars, scale = "column", colors = "Spectral")
```
Run Code Online (Sandbox Code Playgroud)
提示我安装phantomjs:
webshot::install_phantomjs()
phantomjs.exe has been installed to /Users/USERNAME/Library/Application Support/PhantomJS
Run Code Online (Sandbox Code Playgroud)
我.Rmd再次尝试运行该文件,但出现此错误:
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
Run Code Online (Sandbox Code Playgroud)
我相信错误告诉我 R 找不到 phantomjs.exe,但我看到它位于指定的路径中。我知道这会引起愚蠢的用户错误。