在knitr中使用webshot [英] using webshot within knitr
问题描述
在尝试找到有关此保存问题的此SO问题的过程中d3heatmap
产生的热图,我在webshot遇到了不相关的问题> knitr
的开发版本(HT: hrbrmstr ).
library(devtools)
devtools::install_github('yihui/knitr', build_vignettes = TRUE)
library(knitr)
在安装并加载knitr
的开发版本后,我尝试运行以下.Rmd
文件:
---
title: "Untitled"
output: pdf_document
---
```{r}
library(d3heatmap)
d3heatmap(mtcars, scale = "column", colors = "Spectral")
```
系统提示我安装phantomjs:
webshot::install_phantomjs()
phantomjs.exe has been installed to /Users/USERNAME/Library/Application Support/PhantomJS
我尝试再次运行.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
我相信该错误告诉我R找不到phantomjs.exe,但我发现它位于指定的路径中.我知道这会响起愚蠢的用户错误.
这是已知错误,并且已在 webshot 的当前开发版本中进行了修复. /p> In the process of trying to find a solution to this SO question about saving a heatmap produced by After installing and loading the development version of I was prompted to install phantomjs: I tried running the I believe that the error is telling me that R can't find phantomjs.exe, but I see that it's located in the specified path. I know this screams stupid user error. This is a known bug and has been fixed in the current development version of webshot. 这篇关于在knitr中使用webshot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!d3heatmap
, I encountered an unrelated problem using webshot
within the development version of knitr
(HT: hrbrmstr). library(devtools)
devtools::install_github('yihui/knitr', build_vignettes = TRUE)
library(knitr)
knitr
, I tried running the following .Rmd
file:---
title: "Untitled"
output: pdf_document
---
```{r}
library(d3heatmap)
d3heatmap(mtcars, scale = "column", colors = "Spectral")
```
webshot::install_phantomjs()
phantomjs.exe has been installed to /Users/USERNAME/Library/Application Support/PhantomJS
.Rmd
file again, but I 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