生成多级表

时间:2018-03-21 11:48:55

标签: r knitr

我是这样的傻瓜:

# df
# A tibble: 3 x 5
  name  town         pop lan     score
  <chr> <chr>      <dbl> <chr>   <dbl>
1 A     London 15000000. english    7.
2 B     Paris  10000000. french     8.
3 C     Berlin  7500000. german     6.

我想在knitr中生成一个如下所示的表:

London   15000000    A
----------------------
Score           7
lan       english
======================
Paris    10000000    B
----------------------
Score           8
lan        french
======================
Berlin    7500000    C
----------------------
Score           6
lan        german

有什么想法吗?

以下是重现tibble的代码:

df <- tibble(name=c("A","B","C"),town=c("London","Paris","Berlin"),pop=c(15000000,10000000,7500000),lan=c("english","french","german"),score=c(7,8,6))

0 个答案:

没有答案