Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading kableExtra breaks printing in skimr #592

Closed
elinw opened this issue Feb 25, 2021 · 6 comments
Closed

Loading kableExtra breaks printing in skimr #592

elinw opened this issue Feb 25, 2021 · 6 comments

Comments

@elinw
Copy link

elinw commented Feb 25, 2021

Describe the bug
We have a report and have confirmed that simply loading kableExtra in an rmarkdown file breaks the printing of skimr. ropensci/skimr#637

The issue occurs just by loading the library, it is not necessary to actually use any functions. By default, skimr uses the knitr api for rendering when not in the console.

I've confirmed that the column titles are not formatted correctly.
Additionally, in the console, when knitExtra is loaded, but not used and kable is used explicitly the results are changed to html.

If you can tell us how to fix this in our code that would be great, otherwise maybe there is a way that you can fix within kableExtra.

To Reproduce

---
title: "A reproducible example in rmarkdown"
output: 
  html_document:
    latex_engine: xelatex
---

```{r}
library(skimr)
library(knitr)
library(kableExtra) # this messes up the skim table
```

```{r}
skim(iris)
```

Example 2 in the console.

library(skimr)
library(knitr)
library(kableExtra)
skim(iris) %>% knitr::kable()
@haozhu233
Copy link
Owner

haozhu233 commented Feb 25, 2021

Yeah, I made a dirty design choice in the early age of this package that if you load it it will change the default format of kable to html... That could be the root cause of all these issues. Anyway, I will look into this later today when I get time.

@elinw
Copy link
Author

elinw commented Mar 20, 2021

@haozhu233 Did you ever get a chance to think about this?

@elinw
Copy link
Author

elinw commented Jan 1, 2022

@haozhu233 Do you have any thoughts on this? Also dirty, but maybe we should force a change?

@francojc
Copy link

A work around is to set an option to avoid kableExtra from generating HTML table output.

options(kableExtra.auto_format = FALSE) # avoid kableextra from outputting HTML on kable tables

@iago-pssjd
Copy link
Contributor

Thanks @francojc that works for me, setting it before loading kableExtra.

@vincentarelbundock
Copy link
Collaborator

This should be fixed in the master development branch on Github. Please comment if you still run into the issue after installing from Github and restarting R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants