yihui / printr

Some (magical) printing methods for knitr
https://yihui.org/printr/
118 stars 24 forks source link

1-dim table with caption #30

Closed dmenne closed 7 years ago

dmenne commented 7 years ago

I have seen #15 how to print a caption with table, but I did not find a solution how to add a caption to a simple 1-dim table when printr is loaded.

This gives a subscript error

x1 = sample(letters[1:3], 1000, TRUE)
kable(table(x1), caption = "...")
table(x1)  # nice printout with knitr, but no caption
yihui commented 7 years ago

Please try the current dev version and

```{r, printr.table.caption = "..."}
library(printr)
x1 = sample(letters[1:3], 1000, TRUE)
table(x1)