【问题标题】:Align multiple tables side by side using the flextable R package in R markdown使用 R markdown 中的 flextable R 包并排对齐多个表格
【发布时间】:2021-03-10 15:07:08
【问题描述】:

伙计们,如何使用 R markdown 中的 flextable R 包并排对齐多个表格?

---
title: "flextables side by side"
output:
word_document: default
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(flextable)
library(dplyr)
```
## Please, plot these tables side by side!
```{r pressure, echo=FALSE}
flextable(pressure[1:7,])%>% set_caption(caption = "Table 1")
flextable(cars[1:5,])%>% set_caption(caption = "Table 2")
```

还有其他包的例子:

Align multiple tables side by side

Rmarkdown side-by-side tables spacing

【问题讨论】:

    标签: r formatting alignment r-markdown flextable


    【解决方案1】:

    这对我有用。

    library(webshot)
    flextable(pressure[1:7,])%>% set_caption(caption = "Table 1") %>% save_as_image("tmp1.png")
    flextable(cars[1:5,])%>% set_caption(caption = "Table 2") %>% save_as_image("tmp2.png")
    knitr::include_graphics(c("tmp1.png", "tmp2.png"))
    

    【讨论】:

    • 好吧,这并不是我所希望的答案,而是一个可以接受的解决方法。
    猜你喜欢
    • 2019-03-11
    • 2018-09-02
    • 1970-01-01
    • 2018-03-31
    • 2020-05-20
    • 1970-01-01
    • 1970-01-01
    • 2016-10-03
    • 1970-01-01
    相关资源
    最近更新 更多