0

I am trying to use the function kable_as_image, which from my understanding will save the table as a image. My results though is not a table, dont know if I am doing something wrong as I cant find an example.

---
title: "Untitled"
author: "Test"
date: '2017-11-29'
output: pdf_document
---

```{r}
library(knitr)
library(kableExtra)
```

```{r}
kable_as_image(kable(head(iris)), filename = "~/Documents/.../.../pic")
```

#warning: kpathsea: gloss-$mainlang$.ldf: Unrecognized variable construct `$.'.

What my "picture" looks like:

enter image description here

MLEN
  • 2,162
  • 2
  • 20
  • 36

1 Answers1

2

Now I feel like kable_as_image is a somehow misleading name for the function. As explained in the doc, as least right now, it only works for latex tables, try kable_as_image(kable(..., format = "latex", booktabs = T), filename = "pic").

Hao
  • 7,476
  • 1
  • 38
  • 59
  • I'm getting that error even when specifying `format = 'latex'` any ideas? – Mooks Apr 05 '18 at 14:58
  • I forgot to add that - weirdly, the Word document is still generated, with the table as an image, but with the error message appearing above it as code-text (i.e. grey background and not an image). – Mooks Apr 05 '18 at 15:12