skimr errors when knitting to pdf

I have a markdown file with skimr::skim summaries of several dataframes. It will knit to html without issue, however when I try to knit to pdf I get the following error message:

Error in kable_latex(x = c("Name", "Number of rows", "Number of columns", : unused argument (table.attr = "style='width: auto; '\n class='table table-condesned'") Calls: ... knit_print -> knit_print.skim.df -> -> do.call Execution halted

I have tried changing to a different latex engine and knitting with a different font but the same error crops up each time. Removing the skim allows the file to knit fine. Is there any way to get these skimr summaries to work or should I look at alternative dataframe summaries?

I'm not sure that you can knit skimr. I have tried in the past with knitting to html and that doesn't work. If it can be done, that would be great.

Docs let understand it should work : https://docs.ropensci.org/skimr/#knitted-results

But maybe there is an issue with skimr output for knitr. @Jared_Allen we would need a reproducible example to look further

1 Like

You're right. I must have been doing something wrong earlier.

It would knit the skim to html without an issue, but there was an error to pdf though with the character encoding. Changing the engine to latex_engine to xelatex fixed it for me though.

---
output:
  pdf_document:
    latex_engine: xelatex
---
1 Like

default engine is pdflatex and there are limitations in known UTF8 character. xelatex don't have that limitation. Some info on this here (https://www.overleaf.com/learn/how-to/What_file_encodings_and_line_endings_should_I_use%3F#Support_with_LaTeX_and_pdfLaTeX) but you can find more on the web.

pdflatex is fine most of the time but sometimes another engine is required. For example if you want to change font. See options here (https://bookdown.org/yihui/rmarkdown/pdf-document.html#latex-options)

I have discovered that to output to pdf format, the skim has to be wrapped in the kable function with chuck options setting output to "asis"

skim(iris)

will throw an error for me if I try to knit pdf, but

kable(skim(iris))

will knit.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.