
Related to #687.

With R gt table objects:

html: 
1. works fine when code creates and shows table object
2. if code saves but does NOT display table object, it renders nonetheless, albeit differently than in number 1 -- rendered as if retrieved from file (larger - not sure there are other differences)
3. if code retrieves table object from file, it renders differently (larger) than when created and shown)

pdf:
1. works fine when code creates and shows table object
2. same as html number 2
3. same as html number 3

docx:
1. table does not render when code creates and shows table object
2. same as html number 2
3. same as html number 3



------------------------------------------- mre below --------------------------------------------------------------------------------------------

---
title: "Surprising html, pdf, and docx rendering behavior with R gt table objects"
number-sections: true
toc: true
---

```{r}
#| label: setup
#| include: false

library(tidyverse)
library(gt)
# devtools::session_info()
# devtools::package_info()

df <- tibble(rank=1:10, money=seq(100, 1000, 100))


```


## Environment

- Windows 10 x64 (build 22598)
- R version 4.1.3 (2022-03-10)
- RStudio-2022.06.0-daily-310.exe
- quarto-0.9.282-win.msi
- gt * 0.4.0  2022-02-15 [1] CRAN (R 4.1.2)


\newpage
## SHOW gt object but do not save

-   as html, text and table render
-   as pdf, text and table render
-   as docx, text renders but table does NOT render(!)

```{r}

tab <- df %>% 
  mutate(type="SHOW gt object but do NOT save") %>%
  gt() %>% 
  cols_label(rank="Rank", money="Amount")

tab

```


\newpage
## SAVE gt object but do NOT show

- as html, text renders, and table object renders (!), differently, as if retrieved from file
- as pdf, same as html
- as docx, same as html

```{r}

tab <- df %>% 
  mutate(type="SAVE gt object but do NOT show") %>%
  gt() %>% 
  cols_label(rank="Rank", money="Amount")

gtsave(tab, "tab.png")

```

\newpage
## Retrieve and SHOW previously saved gt object

- as html, table object renders, but differently than when created and shown
- as pdf, same as html
- as docx, same as html

![](tab.png)




2022-04-20T11:42:35Z
donboyd5
closed
Surprising html, pdf, and docx rendering behavior with R gt table objects
https://github.com/quarto-dev/quarto-cli/issues/698