小编tci*_*tci的帖子

如何删除gt表中的一行列标签?

#Preparing the data and loading packages

library(modelsummary);library(tidyverse);library(gt)
as_tibble(mtcars)
df <- mtcars %>% mutate(cyl_ = factor(cyl)) %>% 
  dplyr::select(cyl_, mpg, vs, am, hp, wt)

#Gets table of descriptive statistics about different subsets of the data

print(t1 <- datasummary_balance(~cyl_, 
                          data = df,
                          output = "gt"))

#This hides the "Std. Dev." columns

t1 %>% cols_hide(c(3,5,7))

#Now I want to hide the "Mean" column labels, but I want to keep the "cyl_" value column labels. Any ideas how?
  
Run Code Online (Sandbox Code Playgroud)

我想要这样的东西:

在此输入图像描述

r gt modelsummary

3
推荐指数
1
解决办法
2117
查看次数

标签 统计

gt ×1

modelsummary ×1

r ×1