I have two tables below:
Healthy Control:
df1 <- data.frame(pt="HC",subset1=rnorm(10,20,0.2), subset2=rnorm(10,20,0.2))
Disease:
df2 <- data.frame(pt="Dz",subset1=rnorm(10,10,0.2), subset2=rnorm(10,10,0.2))
I am doing:
full <- rbind(pivot_longer(df1,-pt), pivot_longer(df2,-pt))
ggplot(full, mapping = aes(x = name, y = value, fill=name)) +
geom_violin() +
geom_jitter(shape = 16, position = position_jitter(0.3)) +
facet_wrap(~pt)
I am hoping to run a t test and compare subset1 and subset2 between the two groups and if the difference is significant, I want to show it on top of the disease graph. similar to this: