【发布时间】:2021-06-03 00:49:19
【问题描述】:
我正在尝试使用 R DataExplorer 包生成一些报告,但由于某种原因,虽然 html 报告的工作原理很吸引人,但 pdf 报告的创建却惨遭失败。 这可能是一个 pandoc 问题,但请查看帖子末尾的 reprex。
欢迎提出任何建议!
library(DataExplorer)
create_report(iris
,
output_file = "report.html") ### this works
#> processing file: report.rmd
#> output file: /tmp/RtmpnWllz3/reprex347124a8c7df/report.knit.md
#> /usr/bin/pandoc +RTS -K512m -RTS /tmp/RtmpnWllz3/reprex347124a8c7df/report.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpnWllz3/reprex347124a8c7df/report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --standalone --section-divs --table-of-contents --toc-depth 6 --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:yeti' --include-in-header /tmp/RtmpDWU78N/rmarkdown-str348854cbcbb6.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
#>
#> Output created: report.html
## but this does not!
create_report(iris
,
output_file = "report.pdf")
#> processing file: report.rmd
#> output file: /tmp/RtmpnWllz3/reprex347124a8c7df/report.knit.md
#> /usr/bin/pandoc +RTS -K512m -RTS /tmp/RtmpnWllz3/reprex347124a8c7df/report.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpnWllz3/reprex347124a8c7df/report.pdf --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --standalone --section-divs --table-of-contents --toc-depth 6 --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:yeti' --include-in-header /tmp/RtmpDWU78N/rmarkdown-str348863c0475e.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
#> Error: pandoc document conversion failed with error 1
## how to fix it....
print(sessionInfo())
#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 10 (buster)
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so
#>
#> locale:
#> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
#> [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
#> [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] knitr_1.31 rmarkdown_2.6 data.table_1.13.6 DataExplorer_0.8.2
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.6 plyr_1.8.6 pillar_1.4.7 compiler_4.0.4
#> [5] highr_0.8 tools_4.0.4 digest_0.6.27 jsonlite_1.7.2
#> [9] evaluate_0.14 lifecycle_1.0.0 tibble_3.0.6 gtable_0.3.0
#> [13] pkgconfig_2.0.3 rlang_0.4.10 reprex_1.0.0 igraph_1.2.6
#> [17] DBI_1.1.1 curl_4.3 parallel_4.0.4 yaml_2.2.1
#> [21] xfun_0.21 gridExtra_2.3 xml2_1.3.2 httr_1.4.2
#> [25] styler_1.3.2 stringr_1.4.0 dplyr_1.0.4 generics_0.1.0
#> [29] fs_1.5.0 vctrs_0.3.6 htmlwidgets_1.5.3 grid_4.0.4
#> [33] tidyselect_1.1.0 glue_1.4.2 R6_2.5.0 reshape2_1.4.4
#> [37] farver_2.0.3 ggplot2_3.3.3 purrr_0.3.4 magrittr_2.0.1
#> [41] backports_1.2.1 scales_1.1.1 ellipsis_0.3.1 htmltools_0.5.1.1
#> [45] networkD3_0.4 assertthat_0.2.1 mime_0.10 colorspace_2.0-0
#> [49] labeling_0.4.2 stringi_1.5.3 munsell_0.5.0 crayon_1.4.1
由reprex package (v1.0.0) 于 2021-03-04 创建
【问题讨论】: