R 使用expss包的行标签

R 使用expss包的行标签,r,expss,R,Expss,是否可以在每行上重复标签,以使以下代码的输出看起来相似: 而不是: 其中,所需输出应包含每行上的标签,而不仅仅是第一行上的标签 library("expss") data(mtcars) mtcars = apply_labels(mtcars, mpg = "Miles/(US) gallon", cyl = "Number of cylinders", dis

是否可以在每行上重复标签,以使以下代码的输出看起来相似:

而不是:

其中,所需输出应包含每行上的标签,而不仅仅是第一行上的标签

library("expss")
data(mtcars)
mtcars = apply_labels(mtcars,
                      mpg = "Miles/(US) gallon",
                      cyl = "Number of cylinders",
                      disp = "Displacement (cu.in.)",
                      hp = "Gross horsepower",
                      drat = "Rear axle ratio",
                      wt = "Weight (lb/1000)",
                      qsec = "1/4 mile time",
                      vs = "Engine",
                      vs = c("V-engine" = 0,
                             "Straight engine" = 1),
                      am = "Transmission",
                      am = c("Automatic" = 0,
                             "Manual"=1),
                      gear = "Number of forward gears",
                      carb = "Number of carburetors"
)
 mtcars %>% 
     tab_cells(cyl, gear) %>% 
     tab_prepend_all %>% 
     tab_cols(total(), vs) %>% 
     tab_stat_cpct() %>% 
     tab_pivot()

如果将
用作.datatable\u小部件
函数用于输出,则有一个特殊参数
repeat\u row\u labels
。将其设置为
TRUE
,以获得所需的结果。如果您使用的是
split\u columns
,则还有一个不一致的参数,其名称为
remove\u repeated
。将其设置为
FALSE
以重复行标签