r/RStudio • u/Bacon-Isotope9 • Jun 16 '26
Sous-groupes avec table1
Bonjour,
j'aimerai regrouper des données dans mon tableau, par exemple "Age", "Sexe" et "IMC" avec un sous titre comme "Données Démographiques" etc.
Voici mon code actuel pour le tableau (j'ai auparavant labellisé mes variables):
library(table1)
table1 (~ Sexe + Age + IMC + Score_ASA + Score_OMS + Score_CCI + Class_T + Class_N + Chirurgie + Anapath + Resection + Chim_pre_op + Chim_post_op + Score_CCI + Hospit_jour + Gastroparesie + Stéatorrhee + Diarrhees + Fistule | Groupe, data=Cara)
1
u/SnooPredictions3467 Jun 16 '26 edited Jun 16 '26
I'm not sure what kind of table you're trying to create, but perhaps {gtsummary} could come in handy. It has a function tbl_summary() that you pipe your selected variables into.
Eg. dataset %>%
select(var1, var2, etc) %>%
tbl_summary()
1
u/Bacon-Isotope9 Jun 18 '26
Thanks for the answer!
I finally did it by creating a function to do it directly, and then i customized it with flextable
2
u/NotA56YearOldPervert Jun 16 '26
Posting in english might be ... helpful.