1

下面的 expss 脚本。在没有 tab_sort_asc() 的情况下运行,然后使用它。[最后几行]。tab_row_labels 被排序。如何防止这种情况?

mtcars %>%
  #####################################
  tab_row_label("Additional labels1 - means of numeric variable") %>%
  tab_cols(total(), vs) %>% 
  tab_cells(mpg) %>% #Numeric
  tab_stat_mean()%>%
  tab_stat_valid_n() %>%
  #####################################
  tab_subgroup(gear>3) %>% 
  tab_row_label("") %>% 
  tab_row_label("Additional labels2 - filtered for gears > 3") %>%
  tab_cells(vs,am) %>% # Categorical
  tab_stat_cpct(total_row_position = "above",
                total_label = c(" N", " Row %", " Col %"),
                total_statistic = c("u_cases", "u_rpct")) %>%
  ####################################
#tab_pivot()

tab_pivot() %>% 
  tab_sort_asc()
4

0 回答 0