hughjonesd / huxtable

An R package to create styled tables in multiple output formats, with a friendly, modern interface.
http://hughjonesd.github.io/huxtable
Other
321 stars 28 forks source link

RMarkdown/knitr to HTML with huxtable fails #30

Closed mfherman closed 6 years ago

mfherman commented 7 years ago

I'm a new huxtable user and I'm having some trouble printing a table in HTML via RMarkdown/knitr. When I try to knit a document with the simple example from the huxtable vignette, I get an error.

ht <- hux(
        Employee     = c('John Smith', 'Jane Doe', 'David Hugh-Jones'), 
        Salary       = c(50000, 50000, 40000),
        add_colnames = TRUE
      )
ht
"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS scrie_analysis.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output scrie_analysis.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\MHerman\R\Library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\MHerman\AppData\Local\Temp\RtmpEHNoEf\rmarkdown-str1a885fdb4ae5.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 
Error in writeLines(output_str, output_file, useBytes = TRUE) : 
  Error writing to connection:  Permission denied
Calls: <Anonymous> -> <Anonymous> -> writeLines
Execution halted

Just as test, I tried knitting the same document but using knitr::kable instead of hux and the document knits to HTML with no problem.

Any ideas?

hughjonesd commented 7 years ago

Looks like a permissions issue on the folder, but why it should only affect hux I don't know. Can you show me the equivalent pandoc command line using kable

hughjonesd commented 7 years ago

Also can you provide a traceback with options(error=traceback)

mfherman commented 7 years ago

Here is the traceback I get when I try to render the .Rmd file with the hux:

output file: test_hux.knit.md

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS test_hux.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test_hux.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\MHerman\R\Library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\MHerman\AppData\Local\Temp\RtmpmcG6te\rmarkdown-str202864af7588.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 
Error in writeLines(output_str, output_file, useBytes = TRUE) : 
  Error writing to connection:  Permission denied
3: writeLines(output_str, output_file, useBytes = TRUE)
2: output_format$post_processor(yaml_front_matter, utf8_input, output_file, 
       clean, !quiet)
1: rmarkdown::render("./test_hux.Rmd")

The pandoc output for the successful kable version looks to be the same as the hux that throws the error

output file: test_kable.knit.md

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS test_kable.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test_kable.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\MHerman\R\Library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\MHerman\AppData\Local\Temp\Rtmp8eQRFp\rmarkdown-str1cd44294162e.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 

Output created: test_kable.html
hughjonesd commented 7 years ago

The only thing I can do is suggest you debug with options(error=recover) and see where and why it is writing to a file and getting permission denied.

hughjonesd commented 6 years ago

Assuming this is not a huxtable issue