Esraa Alfadul
Esraa Alfadul

Reputation: 1

Kruskal-Wallis test using gtsummary package

I tried to run the Kruskal Wallis test for multiple variables at once, but I couldn't. I want to display the mean±SD in the table instead of the median(IQR) similar to what in this image

enter image description here

Here is my data:



df1<- data.frame(Age=c(25,35,24,34,19,20,28,31),
Gender=c("F","M","M","M","F","M","F","F"),
Year_study=c("final","first","second","first","third","second","fourth","first"),
D_score=c(22,25,35,16,32,22,41,19))


print(df1)

I tried this loop:

cols<- names(df1)[1:3]
 all<- lapply(cols, function(x)kruskal.test(reformulate("D_score",x), data=df1))
 all

But I can't convert it to table using gtsummary

I appreciate any help you can provide.

Upvotes: 0

Views: 254

Answers (0)

Related Questions