小编Man*_*lo 的帖子

使用 expss 在 R Marksdown 中格式化表格

我有在格式化使用一些表格一些麻烦expss的一个R Markdown。输出是一个pdf文件。knitr选项是:

knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
Run Code Online (Sandbox Code Playgroud)

跟随小插图expss(可在此处获得https://cran.r-project.org/web/packages/expss/vignettes/tables-with-labels.html),我编写了以下代码:

sl_expss_long %>%  # the tibble
  calc_cro_cpct(
    cell_vars = list(br, cl, cm, fgm, vd), # rows
    col_vars = list(total(), area) # columns
  ) %>% 
  set_caption("Table 1")
Run Code Online (Sandbox Code Playgroud)

此代码在 中运行良好R Studio,并生成此表:

 Table 1                                                                                    
 |                                      |              |  #Total |   Area |        |
 |                                      |              |         |  Rural |  Urban |
 | ------------------------------------ | ------------ | ------- | ------ | ------ …
Run Code Online (Sandbox Code Playgroud)

markdown r knitr expss

5
推荐指数
1
解决办法
540
查看次数

标签 统计

expss ×1

knitr ×1

markdown ×1

r ×1