Use hooks to format table in output

前端 未结 4 1152
情话喂你
情话喂你 2020-12-20 14:08

Using knitr and R Markdown, I can produce a tabularised output from a matrix using the following command:

```{r results=\'asis\'}
kable(head(x))
```
<         


        
4条回答
  •  礼貌的吻别
    2020-12-20 14:26

    I think other answers are from a time when the following didn't work, but now we can just do :

    ```{r results='asis', render=pander::pander}
    head(x)
    ```
    

    Or set this for all chunks in the setup chunk, for instance :

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

提交回复
热议问题