haozhu233 / haozhu233/kableExtra

version 1.4.0 of kableExtra, save_kable() does not export the pdf as formatted in html

Open
#830 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
737
Forks
149
PR merge metrics
No merged PRs in 30d

Description

**Description**
The output of the function `save_kable()` of package versions **1.3.4** and **1.4.0**, differs.

More specifically, the function `save_kable()` of package version **1.3.4** works as expected. It extracts the *HTML* (refer to the left image) and *PDF* (refer to the right image) in the correct format.
![export_1 3 4](https://github.com/haozhu233/kableExtra/assets/34791402/721c4e9c-b02c-49c4-b78b-6c100726d75d)

However, the same function of the package version **1.4.0**, does not work as expected. After installing the recommended package `webshot2` with its dependencies, the function extracts the *HTML* (refer to the left image) in the correct format, but the *PDF* (refer to the right image) is not extracted as expected.
![export_1 4 0](https://github.com/haozhu233/kableExtra/assets/34791402/bc16a6e0-cfc0-4e34-a647-9363bdc17c0f)
\
\
In addition, it was noted that the exported info messages of the function `save_kable()`, differ between the two versions:
**kableExtra version: 1.3.4**
![save_kable_1 3 4](https://github.com/haozhu233/kableExtra/assets/34791402/2d8f159e-a707-4ed7-929c-3578611235b0)

**kableExtra version: 1.4.0**
![save_kable_1 4 0](https://github.com/haozhu233/kableExtra/assets/34791402/e8007ef9-d498-437b-8a42-feeca528855f)
\
\
**To Reproduce**

Please try to reproduce the below code, using versions **1.3.4** and **1.4.0** of the package `kableExtra`, and inspect the pdf outputs.

```
iris_df <- iris[(48:52), ]

rownames(iris_df) <- NULL

pdf_df <- knitr::kable(iris_df, caption = "Iris Dataset", align = "ccccr") |>
kableExtra::kable_paper() |>
kableExtra::column_spec(5, bold = TRUE, border_right = TRUE, background ="#F2EFC8") |>
kableExtra::kable_styling(bootstrap_options = "basic", full_width = FALSE, position = "center", font_size = 20) |>
kableExtra::kable_classic(full_width = FALSE, html_font = "Cambria") |>
kableExtra::pack_rows(group_label = "setosa species", start_row = 1, end_row = 3, underline = TRUE) |>
kableExtra::pack_rows(group_label = "versicolor species", start_row = 4, end_row = 5, underline = TRUE) |>
kableExtra::footnote(general = "The end")

kableExtra::save_kable(pdf_df, "iris_df.pdf")

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided save_kable() reproduction with kableExtra 1.3.4 and 1.4.0, including the recommended webshot2 dependency. Compare the HTML and PDF output and the exported messages; done means version 1.4.0 produces a PDF formatted consistently with the HTML and the expected messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.