dataExplorer::create_report 编译失败

Posted

技术标签:

【中文标题】dataExplorer::create_report 编译失败【英文标题】:dataExplorer::create_report failed to compile 【发布时间】:2019-05-09 16:02:10 【问题描述】:

我正在尝试使用 DataExplorer 包生成名为“mydata”的数据框的 pdf 报告。尽管如此,我还是收到以下错误:无法编译 D:/Documents/R/R projects/ENDO/report.tex。

我尝试使用以下方法查看 tinytex 是否出现任何错误:

options(tinytex.verbose = TRUE)
devtools::install_github('yihui/tinytex')

但没有检测到错误。

这是我使用的初始代码:

options(tinytex.verbose = TRUE)
DataExplorer::create_report(mydata, output_format = "pdf_document")

这是输出:

processing file: report.rmd
  |..                                                               |   2%
  ordinary text without R code

  |...                                                              |   5%
label: global_options (with options) 
List of 1
 $ include: logi FALSE

  |.....                                                            |   7%
  ordinary text without R code

  |......                                                           |  10%
label: introduce
  |........                                                         |  12%
  ordinary text without R code

  |.........                                                        |  14%
label: plot_intro
  |...........                                                      |  17%
  ordinary text without R code

  |............                                                     |  19%
label: data_structure
  |..............                                                   |  21%
  ordinary text without R code

  |...............                                                  |  24%
label: missing_profile
  |.................                                                |  26%
  ordinary text without R code

  |...................                                              |  29%
label: univariate_distribution_header
  |....................                                             |  31%
  ordinary text without R code

  |......................                                           |  33%
label: plot_histogram
  |.......................                                          |  36%
  ordinary text without R code

  |.........................                                        |  38%
label: plot_density
  |..........................                                       |  40%
  ordinary text without R code

  |............................                                     |  43%
label: plot_frequency_bar
  |.............................                                    |  45%
  ordinary text without R code

  |...............................                                  |  48%
label: plot_response_bar
  |................................                                 |  50%
  ordinary text without R code

  |..................................                               |  52%
label: plot_with_bar
  |....................................                             |  55%
  ordinary text without R code

  |.....................................                            |  57%
label: plot_normal_qq
  |.......................................                          |  60%
  ordinary text without R code

  |........................................                         |  62%
label: plot_response_qq
  |..........................................                       |  64%
  ordinary text without R code

  |...........................................                      |  67%
label: plot_by_qq
  |.............................................                    |  69%
  ordinary text without R code

  |..............................................                   |  71%
label: correlation_analysis
  |................................................                 |  74%
  ordinary text without R code

  |..................................................               |  76%
label: principle_component_analysis
  |...................................................              |  79%
  ordinary text without R code

  |.....................................................            |  81%
label: bivariate_distribution_header
  |......................................................           |  83%
  ordinary text without R code

  |........................................................         |  86%
label: plot_response_boxplot
  |.........................................................        |  88%
  ordinary text without R code

  |...........................................................      |  90%
label: plot_by_boxplot
  |............................................................     |  93%
  ordinary text without R code

  |..............................................................   |  95%
label: plot_response_scatterplot
  |...............................................................  |  98%
  ordinary text without R code

  |.................................................................| 100%
label: plot_by_scatterplot

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS "D:/Documents/R/R projects/ENDO/report.utf8.md" --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc3a5c401d986.tex --template "C:\PROGRA~1\R\R-35~1.1\library\RMARKD~1\rmd\latex\DEFAUL~3.TEX" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable "compact-title:yes" 

Error: Failed to compile D:/Documents/R/R projects/ENDO/report.tex.

有什么建议吗?

【问题讨论】:

【参考方案1】:

[截至 2019 年 3 月 19 日的更新]

使用 CRAN (v0.8) 上的最新版本,我可以使用以下代码生成 PDF 报告:

create_report(
  data = iris,
  output_format = pdf_document(),
  output_file = "report.pdf",
  config = configure_report(add_plot_str = FALSE)
)

[过时的答案]

我相信 plot_str 中的 javascript 代码会导致错误,因为 PDF 是静态文档。我可以使用以下代码生成 PDF 报告:

create_report(
    data = iris,
    output_format = "pdf_document",
    output_file = "report.pdf",
    config = list(
        "introduce" = list(),
        "plot_intro" = list(),
        "plot_missing" = list(),
        "plot_histogram" = list(),
        "plot_qq" = list(sampled_rows = 1000L),
        "plot_bar" = list(),
        "plot_correlation" = list("cor_args" = list("use" = "pairwise.complete.obs")),
        "plot_prcomp" = list()
    )
)

【讨论】:

@Woody 你的sessionInfo()是什么?

以上是关于dataExplorer::create_report 编译失败的主要内容,如果未能解决你的问题,请参考以下文章