I have a data frame with continuous and factor-type columns. I'm trying to build a summary table with gtsummary stratifying by a variable. My question is as follows:
- Is there a way to test all numerical variables at one to decide if their distribution is normal (shapiro.test() for example) using one of the apply family functions?
- After doing so, is there a way to tell gtsummary so show normally distributed data as mean(sd) and non-normally distributed data as median(IQR)?
- Can gtsummary decide whether to use methods for comparison of the means according to the distribution? (t test vs. Mann Whitney U test for example).
Thank you!
FC.