Skip to content

Possibility to create an as_word() function? #121

@rich-iannone

Description

@rich-iannone

Currently, we can only use the rtf_document format in R Markdown to generate a Word compatible document with gt tables embedded within.

Here is a minimal example:

---
output: rtf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(gt)
```

# gt Table in RTF document

```{r}
gtcars %>%
  dplyr::filter(ctry_origin == "Germany") %>%
  dplyr::group_by(mfr) %>%
  dplyr::top_n(2, msrp) %>%
  dplyr::ungroup() %>%
  dplyr::select(mfr, model, drivetrain, msrp) %>%
  gt()
```

Which produces this document:

rtf_word_gt

The problem is that the word_document output format for R Markdown doesn't work in this way. Other packages that create display tables haven't yet solved this problem either. Proposal here is to generate a as_word() function to create table output that is compatible with the Word document output that R Markdown generates.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions