How to produce HTML tables and accompanying CSS using R Markdown or HTML Sweave?

前端 未结 5 1779
夕颜
夕颜 2021-02-06 04:13

I previously asked a question about how to export a HTML table in R and have control over line borders.

I\'m used to LaTeX where when you create a table, the formatting

5条回答
  •  野的像风
    2021-02-06 04:32

    One option which doesn't completely solve the problem is to use gvisTable:

    Here is a basic gvisTable:

    ```{r message=FALSE}
    # install.packages("googleVis")
    library(googleVis)
    library(MASS)
    data(Animals)
    ```
    
    ```{r results='asis'}
    tab1 <- gvisTable(Animals, 
                       options = list(width = 600, height = 650, 
                                      page = "enable",
                                      pageSize = nrow(Animals)))
    print(tab1, "chart")
    ```
    
    • ?print.gvis explains some of the options for printing the gvis object.
    • In partiuclar the tag="chart" option is required for R Markdown documents as this means that the output is just what is required for the object, rather than a complete HTML page as is the default.
    • See the output of this and a little more here

提交回复
热议问题