Sylvain133
Sylvain133

Reputation: 1

Knitr::Kable in Rmarkdown with Pandoc to word - Prompt of table in word with Rmarkdown

I need help to prompt a table in my word document with Rmarkdown (compiled by Pandoc).

I take an exemple to resolve my problem. When I do this command :

```{r Table, echo=FALSE}                                                        
knitr::opts_chunk$set(echo = TRUE)                             
knitr::opts_chunk$set(out.width = '100%', dpi=300)                             
knitr::kable(iris)
```

I get this :

But in my word document I wish the table clear...

I tried with DT and WEBSHOT package but it didn't work.

For information, I use the 2.12 version of Pandoc for the compilation.

Thank in advance for your help

Upvotes: 0

Views: 209

Answers (1)

Carlos Luis Rivera
Carlos Luis Rivera

Reputation: 3593

Your code works fine in my environment with Pandoc 2.19.2 and knitr 1.40. You can [u]se a Pandoc version not bundled with the RStudio IDE, as well as upgrade knitr, and check whether the problem is resolved.

enter image description here

If not, the source of your problem comes not from Pandoc or knitr but from other parts. Maybe you need to edit your original post to show a full minimal working example like the following, by adding YAML section.

---
output:
  word_document: default
---

```{r setup, echo=FALSE, include=FALSE}
library(knitr)
opts_chunk$set(
  echo = TRUE,
  out.width = "100%",
  dpi = 300
)
```

```{r Table, echo=FALSE}                                                        
kable(iris)
```

```{r sessionInfo}
rmarkdown::pandoc_version()
packageVersion("knitr")
```

Upvotes: 1

Related Questions