R flextable proc_freq删除标签列

问题描述

在创建proc_freq()柔性表之后,是否可以将其删除?

从头开始(即从数据框)创建柔性表时,可以使用col_keys指定要显示的列。但是,proc_freq()会自行生成表。

如何删除下表中的“标签”列?

library(flextable)
proc_freq(mtcars,"cyl","gear")

enter image description here

解决方法

这有2种方法:

library(flextable)
library(magrittr)
proc_freq(mtcars,"cyl","gear") %>% 
  set_header_labels(label = "")

proc_freq(mtcars,"gear") %>% 
  compose(i = 2,j = 2,value = as_paragraph(""),part = "header")

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...