tbl_summary,有没有办法按行和列比较分类数据?(费舍尔精确检验;Pearson's 卡方检验)

tbl_summary, is there a way to compare categorical data by row as well as column? (Fisher's exact test; Pearson's Chi-squared test)

提问人:Colin Doherty 提问时间:11/11/2023 最后编辑:PhilColin Doherty 更新时间:11/11/2023 访问量:27

问:

表中有多个类别。下面我描述一个变量作为示例,希望它可以应用于变量。

目前,我的代码比较了女性和男性食品控制分数列。但是,食品控制评分有两个级别(“正常”和“高”)。有没有办法使用具有连续性校正的 1 样本比例检验来生成逐行比较的 p 值?

con_tab<-ADE.Joined_tab %>% 
   dplyr::select(sex, `ADE Category`, `Food Control Category`, `Bingeing Category`, 
   `Body Control Category`, `Body Discontent Category`) %>% 
   tbl_summary(by = sex,
   statistic = list(all_categorical() ~ "{n} ({p}%)"),
   digits = list(all_categorical() ~ 1)) %>%
   add_overall(last = T) %>%
   add_p() %>% 
   bold_labels() 

   con_tab

   con_tab$table_body %>% flextable()

仅显示列比较。

enter image description here

R 分类数据 GTCulient

评论


答: 暂无答案