Turns out I need to add the following to the YAML section:
header-includes:
- \usepackage{caption}
And somewhere in front of the code snippet:
\captionsetup[table]{labelformat=empty}
Now it works:
---
title: "Suppress automatic table name and number"
output: pdf_document
header-includes:
- \usepackage{caption}
---
\captionsetup[table]{labelformat=empty}
```{r myirischunk, results = 'asis', tab.cap = NULL, echo = TRUE}
print(knitr::kable(head(iris), caption = "Table 21.a - My very own table name"))
```
It is also described here:
Get rid of captions using texreg in markdowns
, , .
, daroczig , tex , , chunk - .