这似乎与rstudio/bookdown#15有关,但我还不能确定它。示例是here,但令人不快的代码是
p2 <- ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point_interactive(aes(tooltip = car))
ggiraph(code = print(p2))我的bookdown.yml上有new_session: yes。其他htmlwidget也可以工作。
```r
p2 <- ggplot(mtcars, aes(x = disp, y = mpg)) +
geom_point_interactive(aes(tooltip = car))
ggiraph(code = print(p2))会话信息:
$ R
R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(bookdown)
> library(rmarkdown)
> render_book("index.Rmd", "bookdown::gitbook")
processing file: index.Rmd
|................ | 25%
inline R code fragments
|................................ | 50%
label: unnamed-chunk-1 (with options)
List of 1
$ eval: logi FALSE
|................................................. | 75%
ordinary text without R code
|.................................................................| 100%
label: unnamed-chunk-2 (with options)
List of 1
$ include: logi FALSE
output file: index.knit.md
processing file: 01-intro.Rmd
|...... | 9%
ordinary text without R code
|............ | 18%
label: nice-fig (with options)
List of 4
$ fig.cap : chr "Here is a nice figure!"
$ out.width: chr "80%"
$ fig.asp : num 0.75
$ fig.align: chr "center"
|.................. | 27%
ordinary text without R code
|........................ | 36%
label: nice-tab (with options)
List of 1
$ tidy: logi FALSE
|.............................. | 45%
ordinary text without R code
|................................... | 55%
label: load-libs
|......................................... | 64%
ordinary text without R code
|............................................... | 73%
label: ggplot
|..................................................... | 82%
ordinary text without R code
|........................................................... | 91%
label: ggiraph
|.................................................................| 100%
ordinary text without R code
output file: 01-intro.knit.md
processing file: 02-literature.Rmd
|.................................................................| 100%
ordinary text without R code
output file: 02-literature.knit.md
processing file: 03-method.Rmd
|.................................................................| 100%
ordinary text without R code
output file: 03-method.knit.md
processing file: 04-application.Rmd
|.................................................................| 100%
ordinary text without R code
output file: 04-application.knit.md
processing file: 05-summary.Rmd
|.................................................................| 100%
ordinary text without R code
output file: 05-summary.knit.md
processing file: 06-references.Rmd
|.................................................................| 100%
inline R code fragments
output file: 06-references.knit.md
Error: path for html_dependency not found: /var/folders/8r/bytzpgb50dx3159xd49zgtxw0000gn/T//RtmpXcXTft/file142585251ceaa
Please delete bookdown-demo.md after you finish debugging the error.
> library(sessioninfo)
> session_info()
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 3.3.3 (2017-03-06)
os macOS Sierra 10.12.6
system x86_64, darwin13.4.0
ui X11
language (EN)
collate en_US.UTF-8
tz America/New_York
date 2017-09-29
─ Packages ───────────────────────────────────────────────────────────────────
package * version date source
assertthat 0.2.0 2017-04-11 CRAN (R 3.3.2)
backports 1.1.0 2017-05-22 CRAN (R 3.3.2)
base64enc 0.1-3 2015-07-28 CRAN (R 3.3.0)
bindr 0.1 2016-11-13 CRAN (R 3.3.2)
bindrcpp 0.2 2017-06-17 cran (@0.2)
bookdown * 0.5 2017-08-20 CRAN (R 3.3.2)
clisymbols 1.2.0 2017-05-21 CRAN (R 3.3.2)
colorspace 1.3-2 2016-12-14 CRAN (R 3.3.2)
digest 0.6.12 2017-01-27 CRAN (R 3.3.2)
dplyr 0.7.3 2017-09-09 cran (@0.7.3)
evaluate 0.10.1 2017-06-24 CRAN (R 3.3.2)
gdtools 0.1.4 2017-03-17 cran (@0.1.4)
ggiraph * 0.4.0 2017-06-24 CRAN (R 3.3.2)
ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.3.2)
glue 1.1.1 2017-06-21 CRAN (R 3.3.2)
gtable 0.2.0 2016-02-26 CRAN (R 3.3.0)
htmltools 0.3.6 2017-09-27 Github (rstudio/htmltools@02678ee)
htmlwidgets 0.9 2017-09-27 Github (ramnathv/htmlwidgets@2c49516)
knitr 1.17 2017-08-10 CRAN (R 3.3.2)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.3.0)
magrittr 1.5 2014-11-22 CRAN (R 3.3.0)
munsell 0.4.3 2016-02-13 CRAN (R 3.3.0)
officer 0.1.6 2017-08-30 CRAN (R 3.3.2)
pkgconfig 2.0.1 2017-03-21 cran (@2.0.1)
plyr 1.8.4 2016-06-08 CRAN (R 3.3.0)
purrr 0.2.3 2017-08-02 cran (@0.2.3)
R.methodsS3 1.7.1 2016-02-16 CRAN (R 3.3.0)
R.oo 1.21.0 2016-11-01 CRAN (R 3.3.0)
R.utils 2.5.0 2016-11-07 CRAN (R 3.3.0)
R6 2.2.2 2017-06-17 cran (@2.2.2)
Rcpp 0.12.12 2017-07-15 cran (@0.12.12)
rlang 0.1.2 2017-08-09 cran (@0.1.2)
rmarkdown * 1.6 2017-06-15 CRAN (R 3.3.2)
rprojroot 1.2 2017-01-16 CRAN (R 3.3.2)
rstudioapi 0.7.0-9000 2017-09-10 Github (rstudio/rstudioapi@8e8bfb0)
rvg 0.1.4 2017-06-23 CRAN (R 3.3.2)
scales 0.5.0 2017-08-24 CRAN (R 3.3.2)
sessioninfo * 1.0.0 2017-06-21 CRAN (R 3.3.2)
stringi 1.1.5 2017-04-07 CRAN (R 3.3.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.2)
tibble 1.3.4 2017-08-22 cran (@1.3.4)
uuid 0.1-2 2015-07-28 CRAN (R 3.3.0)
withr 2.0.0 2017-07-28 CRAN (R 3.3.2)
xml2 1.1.1 2017-01-24 CRAN (R 3.3.3)
yaml 2.1.14 2016-11-12 CRAN (R 3.3.2)
zip 1.0.0 2017-04-25 CRAN (R 3.3.2) 发布于 2017-09-30 12:45:39
你是对的,这与rstudio/bookdown#15有关。根本原因是HTML uses the temporary directory为小部件创建了依赖项,R将在退出时清理临时目录。因为您使用的是new_session: yes,所以Rmd是在一个单独的R会话中编译的;您的HTML是在那里创建的,但实际上是稍后呈现的(在R会话退出之后)。当它被呈现时,临时目录已经消失了。
因此,您必须在使用ggiraph和new_session: yes之间做出选择。你不能两者兼得。
https://stackoverflow.com/questions/46488976
复制相似问题