boxuancui / DataExplorer

Automate Data Exploration and Treatment
http://boxuancui.github.io/DataExplorer/
Other
512 stars 88 forks source link

Error with create_report() and pdf #146

Closed bitbacchus closed 4 years ago

bitbacchus commented 4 years ago

I just discovered your package and I am totally excited! Very nice and useful, indeed :-)

I just have trouble creating a PDF report. I tried like so:

DataExplorer::create_report(
        data = iris,
        output_format = pdf_document(),
        output_file = "report.pdf"
)

and the error I got

[...]
  |....................................................................  |  98%
  ordinary text without R code

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

output file: ~/report.knit.md

Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:

  always_allow_html: true

Note however that the HTML output will not be visible in non-HTML formats.

Do you have any hint for me? I don't have a rmarkdown file where I could change the YAML header, do I?

Thanks in advance!

boxuancui commented 4 years ago

Hope the following information helps:

  1. The template is stored at DataExplorer/rmd_template/report.rmd. The root directory should be where you save all your libraries. You can find it by typing .libPaths().
  2. You should be able to send your YAML configs throught pdf_document(), since create_report simply calls rmarkdown::render(). You can view the list of parameters here: https://rmarkdown.rstudio.com/pdf_document_format.html%2F
  3. Finally, have you tried saving as HTML first then export as PDF? This is not ideal, and possibly won't address your problem, but just want to bring it up as an option.