其中所需的输出应在每行而不是仅第一行包含标签。
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()
答案 0 :(得分:0)
如果您使用as.datatable_widget
函数进行输出,那么会有一个特殊的参数repeat_row_labels
。将其设置为TRUE
以获得所需的结果。如果您使用的是split_columns
,则还有另一个自变量命名为remove_repeated
的自变量。将其设置为FALSE
以重复行标签。