GT摘要 - 如何仅在桌子的某些行上删除N'
我希望进行测试,test2 ... test7,n不会出现在表中。 但是我不能选择或过滤,也找不到任何解决方案以使其消失,但请留在表的其他变量上。 这是我代码的一部分:
base %>%
tbl_summary(include = all_of(var_interet),
statistic =list(
all_categorical() ~ "{n} ({p}%)",
Test ~ " ",
Test2 ~" ",
Test3 ~ " ",
Test4 ~ " ",
Test5 ~ " ",
Test6 ~ " ",
Test7~ " "),
digits = list(
all_categorical() ~ c(0, 1)
),
type = list(
Q1_oui_systematique ~ "dichotomous",
Q1_non_temps ~ "dichotomous",
Q1_non_outils ~ "dichotomous",
Q1_non_aise ~ "dichotomous",
Q1_non_necessaire ~ "dichotomous",
Q1_non_autre ~ "dichotomous"),
sort = c(ID_type_centre, ID_repondant,presence_tiers1, Q1_oui_systematique, Q2_oui_mod_decouverte, Q4) ~ "frequency",
missing = "no") %>%
bold_labels() %>%
italicize_levels()%>%
modify_spanning_header(all_stat_cols() ~ "**Ps**")%>%
add_n()
我的第二个问题是如何使丢失的数据取决于变量而不是整体上?因为如果我将丢失=“如果”放置,那么对于我的某些数据而言,这是无关紧要的,因为只是无法回答这些问题的人。
非常感谢您的回答,祝您有美好的一天!
I would like that for Test, Test2 ... Test7, that the N does not appear in the table.
But I can't do either select or filter and I can't find any solution to make it disappear but stay on the other variables of the table.
This a part of my code:
base %>%
tbl_summary(include = all_of(var_interet),
statistic =list(
all_categorical() ~ "{n} ({p}%)",
Test ~ " ",
Test2 ~" ",
Test3 ~ " ",
Test4 ~ " ",
Test5 ~ " ",
Test6 ~ " ",
Test7~ " "),
digits = list(
all_categorical() ~ c(0, 1)
),
type = list(
Q1_oui_systematique ~ "dichotomous",
Q1_non_temps ~ "dichotomous",
Q1_non_outils ~ "dichotomous",
Q1_non_aise ~ "dichotomous",
Q1_non_necessaire ~ "dichotomous",
Q1_non_autre ~ "dichotomous"),
sort = c(ID_type_centre, ID_repondant,presence_tiers1, Q1_oui_systematique, Q2_oui_mod_decouverte, Q4) ~ "frequency",
missing = "no") %>%
bold_labels() %>%
italicize_levels()%>%
modify_spanning_header(all_stat_cols() ~ "**Ps**")%>%
add_n()
My second question is how do you make the missing data dependent on the variables and not on the whole? because if i put missing = "ifany", for some of my data it's irrelevant because that just people who couldn't answer theses questions.
Thank you a lot for your answer, have a great day!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定如果没有N对于测试变量,我就会理解您要实现的目标。但是我包括了一个示例。
您可以使用
remove_row_type()
函数来删除所选变量的缺失行。由
I am not sure I understand what you're trying to get achieve without the N for the test variables. But i've included an example with what you may be after.
You can use the
remove_row_type()
function to remove the missing rows for selected variables.Created on 2022-07-01 by the reprex package (v2.0.1)